xmlsitemap_engines.install 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. // $Id: xmlsitemap_engines.install,v 1.5 2010/01/18 07:46:29 davereid Exp $
  3. /**
  4. * @file
  5. * Install, update and uninstall functions for the xmlsitemap_engines module.
  6. */
  7. /**
  8. * Implements hook_install().
  9. */
  10. function xmlsitemap_engines_install() {
  11. // Set this module's weight to 1 so xmlsitemap_engines_cron() runs after
  12. // the sitemap has been generated in xmlsitemap_cron().
  13. db_update('system')
  14. ->fields(array('weight' => 2))
  15. ->condition('type', 'module')
  16. ->condition('name', 'xmlsitemap_engines')
  17. ->execute();
  18. }
  19. /**
  20. * Implements hook_uninstall().
  21. */
  22. function xmlsitemap_engines_uninstall() {
  23. variable_del('xmlsitemap_engines_engines');
  24. variable_del('xmlsitemap_engines_custom_urls');
  25. variable_del('xmlsitemap_engines_minimum_lifetime');
  26. variable_del('xmlsitemap_engines_submit_last');
  27. variable_del('xmlsitemap_engines_submit_updated');
  28. }
  29. /**
  30. * Filter the xmlsitemap_engines_submit variable.
  31. */
  32. function xmlsitemap_engines_update_1() {
  33. variable_set('xmlsitemap_engines_submit', array_filter(variable_get('xmlsitemap_engines_submit', array())));
  34. }
  35. /**
  36. * Rename the xmlsitemap_engines_engines variable to xmlsitemap_engines_submit.
  37. */
  38. function xmlsitemap_engines_update_2() {
  39. variable_set('xmlsitemap_engines_engines', variable_get('xmlsitemap_engines_submit', array()));
  40. variable_del('xmlsitemap_engines_submit');
  41. }
  42. /**
  43. * Increase the module weight so it always runs after sitemap generation.
  44. */
  45. function xmlsitemap_engines_update_3() {
  46. db_update('system')
  47. ->fields(array('weight' => 2))
  48. ->condition('type', 'module')
  49. ->condition('name', 'xmlsitemap_engines')
  50. ->execute();
  51. }
  52. /**
  53. * Update Windows Live search to Bing.
  54. */
  55. function xmlsitemap_engines_update_4() {
  56. $engines = variable_get('xmlsitemap_engines_engines', array());
  57. $index = array_search('windows_live', $engines);
  58. if ($index !== FALSE) {
  59. $engines[$index] = 'bing';
  60. }
  61. variable_set('xmlsitemap_engines_engines', $engines);
  62. }