xmlsitemap_taxonomy.install 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. // $Id: xmlsitemap_taxonomy.install,v 1.4 2010/01/18 06:30:31 davereid Exp $
  3. /**
  4. * @file
  5. * Install and uninstall schema and functions for the xmlsitemap_taxonomy module.
  6. */
  7. /**
  8. * Implements hook_uninstall().
  9. */
  10. function xmlsitemap_taxonomy_uninstall() {
  11. // Remove variables.
  12. drupal_load('module', 'xmlsitemap_taxonomy');
  13. $variables = array_keys(xmlsitemap_taxonomy_variables());
  14. foreach ($variables as $variable) {
  15. variable_del($variable);
  16. }
  17. }
  18. // @todo Remove these update functions before alpha.
  19. function xmlsitemap_taxonomy_update_1() {
  20. $vids = array_keys(taxonomy_get_vocabularies());
  21. foreach ($vids as $vid) {
  22. if (variable_get('xmlsitemap_taxonomy_priority_' . $vid, 'default') === 'default') {
  23. variable_set('xmlsitemap_taxonomy_priority_' . $vid, 0.5);
  24. }
  25. }
  26. }
  27. /**
  28. * Change 'taxonomy' type to 'taxonomy_term'.
  29. */
  30. function xmlsitemap_taxonomy_update_2() {
  31. $field = array(
  32. 'type' => 'varchar',
  33. 'length' => 32,
  34. 'not null' => TRUE,
  35. 'default' => '',
  36. );
  37. db_change_field('xmlsitemap', 'type', 'type', $field);
  38. db_update('xmlsitemap')
  39. ->fields(array('type' => 'taxonomy_term'))
  40. ->condition('type', 'taxonomy')
  41. ->execute();
  42. }
  43. // @todo Convert {xmlsitemap}.subtype from vid to vocabulary_machine_name.