123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- // $Id: xmlsitemap_menu.install,v 1.3 2010/01/18 07:46:28 davereid Exp $
- /**
- * @file
- * Install and uninstall schema and functions for the xmlsitemap_menu module.
- */
- /**
- * Implements hook_uninstall().
- */
- function xmlsitemap_menu_uninstall() {
- // Remove variables.
- drupal_load('module', 'xmlsitemap_menu');
- $variables = array_keys(xmlsitemap_menu_variables());
- foreach ($variables as $variable) {
- variable_del($variable);
- }
- }
- // @todo Remove these update functions before alpha.
- function xmlsitemap_menu_update_1() {
- $value = xmlsitemap_menu_var('menus');
- variable_set('xmlsitemap_menu_menus', array_filter($value));
- }
- function xmlsitemap_menu_update_2() {
- $field = array(
- 'description' => 'The {menu_links}.menu_name of this menu link.',
- 'type' => 'varchar',
- 'length' => 32,
- 'default' => NULL,
- );
- db_add_field('xmlsitemap', 'menu_name', $field);
- db_add_index('xmlsitemap', 'menu_name', array('menu_name'));
- db_query("UPDATE {xmlsitemap} SET menu_name = (SELECT menu_name FROM {menu_links} WHERE mlid = {xmlsitemap}.id) WHERE type = 'menu'");
- }
- function xmlsitemap_menu_update_3() {
- $menus = variable_get('xmlsitemap_menu_menus', array());
- foreach ($menus as $menu) {
- variable_set('xmlsitemap_menu_status_' . $menu, TRUE);
- }
- variable_del('xmlsitemap_menu_menus');
- }
- function xmlsitemap_menu_update_4() {
- }
- function xmlsitemap_menu_update_5() {
- }
- // Skip to 6 since I was stupid and had xmlsitemap_menu_update_5() in xmlsitemap_node.install
- function xmlsitemap_menu_update_6() {
- db_update('system')
- ->fields(array('weight' => 0))
- ->condition('type', 'module')
- ->condition('name', 'xmlsitemap_menu')
- ->execute();
- }
- function xmlsitemap_menu_update_7() {
- $menus = array_keys(menu_get_menus());
- foreach ($menus as $menu) {
- if (variable_get('xmlsitemap_menu_priority_' . $menu, 'default') === 'default') {
- variable_set('xmlsitemap_menu_priority_' . $menu, 0.5);
- }
- }
- }
|