|
1 <?php |
|
2 // $Id: xmlsitemap_engines.install,v 1.3.2.23 2009/07/16 14:34:36 earnie Exp $ |
|
3 |
|
4 |
|
5 /** |
|
6 * @file |
|
7 * Installation file for XML sitemap engines. |
|
8 */ |
|
9 |
|
10 /***************************************************************************** |
|
11 * Drupal hooks. |
|
12 ****************************************************************************/ |
|
13 |
|
14 /** |
|
15 * Implementation of hook_install(). |
|
16 */ |
|
17 function xmlsitemap_engines_install() { |
|
18 db_query("UPDATE {system} SET weight = 15 WHERE name = 'xmlsitemap_engines'"); |
|
19 variable_set('xmlsitemap_engines_cron_timestamp_submit', 0); |
|
20 } |
|
21 |
|
22 /** |
|
23 * Implementation of hook_update_N(). |
|
24 */ |
|
25 function xmlsitemap_engines_update_6100() { |
|
26 $ret[] = update_sql("DELETE FROM {variable} WHERE name = 'xmlsitemap_engines_cron_submit_delay'"); |
|
27 $variables = array( |
|
28 'ask_url' => 'http://submissions.ask.com/ping?sitemap=[sitemap]', |
|
29 'google_url' => 'http://www.google.com/webmasters/tools/ping?sitemap=[sitemap]', |
|
30 'morover_url' => 'http://api.moreover.com/ping?u=[sitemap]', |
|
31 'live_url' => 'http://webmaster.live.com/ping.aspx?siteMap=[sitemap]', |
|
32 'yahoo_url' => 'http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=[sitemap]', |
|
33 ); |
|
34 foreach ($variables as $variable => $value) { |
|
35 variable_set('xmlsitemap_engines_'. $variable, $value); |
|
36 } |
|
37 variable_set('xmlsitemap_engines_cron_submit_frequency', 3600); |
|
38 $ret[] = array( |
|
39 'success' => TRUE, |
|
40 'query' => 'Updated the module settings successfully.', |
|
41 ); |
|
42 return $ret; |
|
43 } |
|
44 |
|
45 /** |
|
46 * Implementation of hook_update_N(). |
|
47 */ |
|
48 function xmlsitemap_engines_update_6106() { |
|
49 $variables = array( |
|
50 'submit', |
|
51 'log_access', |
|
52 'cron_submit_frequency', |
|
53 'cron_submit_delay', |
|
54 ); |
|
55 foreach ($variables as $variable) { |
|
56 $ret[] = @update_sql("UPDATE {variable} SET name = 'xmlsitemap_engines_{$variable}' WHERE name = 'xmlsitemap_{$variable}'"); |
|
57 $ret[] = update_sql("DELETE FROM {variable} WHERE name = 'xmlsitemap_{$variable}'"); |
|
58 } |
|
59 $ret[] = update_sql("UPDATE {system} SET weight = 15 WHERE name = 'xmlsitemap_engines'"); |
|
60 return $ret; |
|
61 } |
|
62 |
|
63 /** |
|
64 * Update variables from Live Search to Bing. |
|
65 */ |
|
66 function xmlsitemap_engines_update_6107() { |
|
67 $variables = array( |
|
68 'submit' => FALSE, |
|
69 'url' => 'http://webmaster.live.com/ping.aspx?siteMap=[sitemap]', |
|
70 'verify' => '', |
|
71 'verify_string' => '', |
|
72 ); |
|
73 foreach ($variables as $variable => $default) { |
|
74 $value = variable_get('xmlsitemap_engines_live_' . $variable, $default); |
|
75 if ($variable == 'url' && $value == $default) { |
|
76 $value = 'http://www.bing.com/webmaster/ping.aspx?siteMap=[sitemap]'; |
|
77 } |
|
78 variable_set('xmlsitemap_engines_bing_' . $variable, $value); |
|
79 variable_del('xmlsitemap_engines_live_' . $variable); |
|
80 } |
|
81 return array(); |
|
82 } |
|
83 |
|
84 /** |
|
85 * Set last submitted timestamp variable if non existent. |
|
86 */ |
|
87 function xmlsitemap_engines_update_6108() { |
|
88 $ret = array(); |
|
89 $submitted = variable_get('xmlsitemap_engines_cron_timestamp_submit', FALSE); |
|
90 if (!$submitted) { |
|
91 variable_set('xmlsitemap_engines_cron_timestamp_submit', 0); |
|
92 $t = get_t(); |
|
93 $ret[] = array( |
|
94 'success' => TRUE, |
|
95 'query' => $t('Variable "xmlsitemap_engines_cron_timestamp_submit" has been created.'), |
|
96 ); |
|
97 } |
|
98 return $ret; |
|
99 } |
|
100 |
|
101 /** |
|
102 * Implementation of hook_uninstall(). |
|
103 */ |
|
104 function xmlsitemap_engines_uninstall() { |
|
105 db_query("DELETE FROM {variable} WHERE name LIKE 'xmlsitemap\_engines\_'"); |
|
106 } |
|
107 |