| 1 |
<?php
|
| 2 |
// $Id: admin_menu.install,v 1.21 2009/09/09 22:43:31 smk Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Install, update, and uninstall functions for the admin menu module.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implementation of hook_schema().
|
| 11 |
*/
|
| 12 |
function admin_menu_schema() {
|
| 13 |
$schema['cache_admin_menu'] = drupal_get_schema_unprocessed('system', 'cache');
|
| 14 |
$schema['cache_admin_menu']['description'] = 'Cache table for Administration menu to store client-side caching hashes.';
|
| 15 |
return $schema;
|
| 16 |
}
|
| 17 |
|
| 18 |
/**
|
| 19 |
* Implementation of hook_install().
|
| 20 |
*/
|
| 21 |
function admin_menu_install() {
|
| 22 |
// Create cache table.
|
| 23 |
drupal_install_schema('admin_menu');
|
| 24 |
// Increase the module weight, so admin_menu catches any alterations made by
|
| 25 |
// other modules in hook_menu_alter().
|
| 26 |
db_query("UPDATE {system} SET weight = 100 WHERE name = 'admin_menu'");
|
| 27 |
}
|
| 28 |
|
| 29 |
/**
|
| 30 |
* Implementation of hook_uninstall().
|
| 31 |
*/
|
| 32 |
function admin_menu_uninstall() {
|
| 33 |
// Remove cache table.
|
| 34 |
drupal_uninstall_schema('admin_menu');
|
| 35 |
// Delete variables.
|
| 36 |
variable_del('admin_menu_devel_modules');
|
| 37 |
variable_del('admin_menu_devel_modules_enabled');
|
| 38 |
variable_del('admin_menu_devel_modules_skip');
|
| 39 |
variable_del('admin_menu_margin_top');
|
| 40 |
variable_del('admin_menu_position_fixed');
|
| 41 |
variable_del('admin_menu_tweak_modules');
|
| 42 |
variable_del('admin_menu_tweak_tabs');
|
| 43 |
variable_del('admin_menu_show_all');
|
| 44 |
variable_del('admin_menu_display');
|
| 45 |
variable_del('admin_menu_cache_server');
|
| 46 |
variable_del('admin_menu_cache_client');
|
| 47 |
}
|
| 48 |
|
| 49 |
/**
|
| 50 |
* Ensure that admin_menu is rebuilt after upgrading to D6.
|
| 51 |
*/
|
| 52 |
function admin_menu_update_6000() {
|
| 53 |
$ret = array();
|
| 54 |
// Drop the {admin_menu} table in admin_menu_update_6000() on sites that used
|
| 55 |
// one of the later patches in #132524.
|
| 56 |
if (db_table_exists('admin_menu')) {
|
| 57 |
$ret[] = update_sql("DROP TABLE {admin_menu}");
|
| 58 |
}
|
| 59 |
return $ret;
|
| 60 |
}
|
| 61 |
|
| 62 |
/**
|
| 63 |
* Wipe and rebuild so we can switch the icon path to <front>.
|
| 64 |
*/
|
| 65 |
function admin_menu_update_6001() {
|
| 66 |
$ret = array();
|
| 67 |
db_delete('menu_links')->condition('module', 'admin_menu')->execute();
|
| 68 |
$ret[] = array('success' => TRUE, 'query' => 'Administration menu links deleted for clean rebuild.');
|
| 69 |
menu_cache_clear('admin_menu');
|
| 70 |
return $ret;
|
| 71 |
}
|
| 72 |
|
| 73 |
/**
|
| 74 |
* Add {cache_admin_menu} table.
|
| 75 |
*/
|
| 76 |
function admin_menu_update_7300() {
|
| 77 |
$ret = array();
|
| 78 |
if (!db_table_exists('cache_admin_menu')) {
|
| 79 |
$schema = drupal_get_schema_unprocessed('system', 'cache');
|
| 80 |
db_create_table($ret, 'cache_admin_menu', $schema);
|
| 81 |
}
|
| 82 |
return $ret;
|
| 83 |
}
|
| 84 |
|
| 85 |
/**
|
| 86 |
* Increase the module weight.
|
| 87 |
*
|
| 88 |
* @see admin_menu_install()
|
| 89 |
*/
|
| 90 |
function admin_menu_update_7302() {
|
| 91 |
$ret = array();
|
| 92 |
$ret[] = update_sql("UPDATE {system} SET weight = 100 WHERE name = 'admin_menu'");
|
| 93 |
return $ret;
|
| 94 |
}
|
| 95 |
|