| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: xmlsitemap_engines.install,v 1.3.2.6.2.13 2010/04/07 22:39:17 davereid Exp $ 3 4 /** 5 * @file 6 * Install, update and uninstall functions for the xmlsitemap_engines module. 7 */ 8 9 /** 10 * Implements hook_install(). 11 */ 12 function xmlsitemap_engines_install() { 13 // Set this module's weight to 1 so xmlsitemap_engines_cron() runs after 14 // the sitemap has been generated in xmlsitemap_cron(). 15 db_query("UPDATE {system} SET weight = 2 WHERE type = 'module' AND name = 'xmlsitemap_engines'"); 16 } 17 18 /** 19 * Implements hook_uninstall(). 20 */ 21 function xmlsitemap_engines_uninstall() { 22 variable_del('xmlsitemap_engines_engines'); 23 variable_del('xmlsitemap_engines_custom_urls'); 24 variable_del('xmlsitemap_engines_minimum_lifetime'); 25 variable_del('xmlsitemap_engines_submit_last'); 26 variable_del('xmlsitemap_engines_submit_updated'); 27 } 28 29 /** 30 * Update engine-specific variables from 6.x-1.x. 31 */ 32 function xmlsitemap_engines_update_6196() { 33 $engines = array( 34 'ask' => 'http://submissions.ask.com/ping?sitemap=[sitemap]', 35 'google' => 'http://www.google.com/webmasters/tools/ping?sitemap=[sitemap]', 36 'moreover' => 'http://api.moreover.com/ping?u=[sitemap]', 37 'bing' => 'http://www.bing.com/webmaster/ping.aspx?siteMap=[sitemap]', 38 'yahoo' => 'http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=[sitemap]', 39 ); 40 $custom_urls = array(); 41 42 foreach ($engines as $engine => $default_url) { 43 if (variable_get("xmlsitemap_engines_{$engine}_url", $default_url) != $default_url) { 44 // If the default URL has changed 45 unset($engines[$engine]); 46 $custom_urls[] = $default_url; 47 } 48 elseif (!variable_get("xmlsitemap_engines_{$engine}_submit", 0)) { 49 unset($engines[$engine]); 50 } 51 } 52 53 if ($engines) { 54 variable_set('xmlsitemap_engines_engines', array_keys($engines)); 55 } 56 if ($custom_urls) { 57 variable_set('xmlsitemap_engines_custom_urls', implode("\n", $custom_urls)); 58 } 59 60 return array(); 61 } 62 63 /** 64 * Upgrade the rest of the 6.x-1.x variables. 65 */ 66 function xmlsitemap_engines_update_6198() { 67 // Submit when updated variable. 68 $value = variable_get('xmlsitemap_engines_submit', 1); 69 variable_set('xmlsitemap_engines_submit_updated', $value); 70 71 // Minimum lifetime variable. 72 $value = variable_get('xmlsitemap_engines_cron_submit_frequency', 0); 73 if ($value == -1) { 74 $value = 0; 75 } 76 variable_set('xmlsitemap_engines_minimum_lifetime', $value); 77 78 // Last submitted variable. 79 $value = variable_get('xmlsitemap_engines_cron_timestamp_submit', 0); 80 variable_set('xmlsitemap_engines_submit_last', $value); 81 82 return array(); 83 } 84 85 /** 86 * Empty update. 87 */ 88 function xmlsitemap_engines_update_6200() { 89 return array(); 90 } 91 92 /** 93 * Cleanup 6.x-1.x variables and weights. 94 */ 95 function xmlsitemap_engines_update_6201() { 96 $ret = array(); 97 $engines = array('google', 'bing', 'live', 'yahoo', 'ask', 'moreover'); 98 foreach ($engines as $engine) { 99 db_query("DELETE FROM {variable} WHERE name LIKE 'xmlsitemap_engines_%s_%%'", $engine); 100 } 101 variable_del('xmlsitemap_engines_cron_submit_frequency'); 102 variable_del('xmlsitemap_engines_cron_timestamp_submit'); 103 variable_del('xmlsitemap_engines_submit'); 104 $ret[] = update_sql("UPDATE {system} SET weight = 2 WHERE type = 'module' AND name = 'xmlsitemap_engines'"); 105 return $ret; 106 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |