admin_menu.install

  1. nittany7 modules/contrib/admin_menu/admin_menu.install
  2. cis7 modules/contrib/admin_menu/admin_menu.install
  3. mooc7 modules/contrib/admin_menu/admin_menu.install

Install, update, and uninstall functions for the admin menu module.

Functions

Namesort descending Description
admin_menu_install Implements hook_install().
admin_menu_schema Implements hook_schema().
admin_menu_uninstall Implements hook_uninstall().
admin_menu_update_6000 Ensure that admin_menu is rebuilt after upgrading to D6.
admin_menu_update_6001 Wipe and rebuild so we can switch the icon path to <front>.
admin_menu_update_7300 Add {cache_admin_menu} table.
admin_menu_update_7302 Increase the module weight.
admin_menu_update_7303 Remove local tasks from {menu_links} table.
admin_menu_update_7304 Remove obsolete 'admin_menu' menu and all orphan links in it.

File

modules/contrib/admin_menu/admin_menu.install
View source
  1. <?php
  2. /**
  3. * @file
  4. * Install, update, and uninstall functions for the admin menu module.
  5. */
  6. /**
  7. * Implements hook_schema().
  8. */
  9. function admin_menu_schema() {
  10. $schema['cache_admin_menu'] = drupal_get_schema_unprocessed('system', 'cache');
  11. $schema['cache_admin_menu']['description'] = 'Cache table for Administration menu to store client-side caching hashes.';
  12. return $schema;
  13. }
  14. /**
  15. * Implements hook_install().
  16. */
  17. function admin_menu_install() {
  18. // Increase the module weight, so admin_menu catches any alterations made by
  19. // other modules in hook_menu_alter().
  20. db_update('system')
  21. ->fields(array('weight' => 100))
  22. ->condition('type', 'module')
  23. ->condition('name', 'admin_menu')
  24. ->execute();
  25. }
  26. /**
  27. * Implements hook_uninstall().
  28. */
  29. function admin_menu_uninstall() {
  30. // Delete variables.
  31. variable_del('admin_menu_components');
  32. variable_del('admin_menu_devel_modules');
  33. variable_del('admin_menu_devel_modules_enabled');
  34. variable_del('admin_menu_devel_modules_skip');
  35. variable_del('admin_menu_margin_top');
  36. variable_del('admin_menu_position_fixed');
  37. variable_del('admin_menu_tweak_modules');
  38. variable_del('admin_menu_tweak_tabs');
  39. variable_del('admin_menu_show_all');
  40. variable_del('admin_menu_display');
  41. variable_del('admin_menu_cache_server');
  42. variable_del('admin_menu_cache_client');
  43. }
  44. /**
  45. * Ensure that admin_menu is rebuilt after upgrading to D6.
  46. */
  47. function admin_menu_update_6000() {
  48. // Drop the {admin_menu} table in admin_menu_update_6000() on sites that used
  49. // one of the later patches in #132524.
  50. if (db_table_exists('admin_menu')) {
  51. db_drop_table('admin_menu');
  52. }
  53. }
  54. /**
  55. * Wipe and rebuild so we can switch the icon path to <front>.
  56. */
  57. function admin_menu_update_6001() {
  58. db_delete('menu_links')->condition('module', 'admin_menu')->execute();
  59. menu_cache_clear('admin_menu');
  60. }
  61. /**
  62. * Add {cache_admin_menu} table.
  63. */
  64. function admin_menu_update_7300() {
  65. if (!db_table_exists('cache_admin_menu')) {
  66. $schema = drupal_get_schema_unprocessed('system', 'cache');
  67. db_create_table('cache_admin_menu', $schema);
  68. }
  69. }
  70. /**
  71. * Increase the module weight.
  72. *
  73. * @see admin_menu_install()
  74. */
  75. function admin_menu_update_7302() {
  76. db_update('system')
  77. ->fields(array('weight' => 100))
  78. ->condition('type', 'module')
  79. ->condition('name', 'admin_menu')
  80. ->execute();
  81. }
  82. /**
  83. * Remove local tasks from {menu_links} table.
  84. */
  85. function admin_menu_update_7303() {
  86. db_delete('menu_router')
  87. ->condition('path', 'admin/%', 'LIKE')
  88. ->condition('type', MENU_IS_LOCAL_TASK, '&')
  89. ->execute();
  90. }
  91. /**
  92. * Remove obsolete 'admin_menu' menu and all orphan links in it.
  93. */
  94. function admin_menu_update_7304() {
  95. // Remove the custom menu used by 6.x-1.x.
  96. if (db_table_exists('menu_custom')) {
  97. db_delete('menu_custom')->condition('menu_name', 'admin_menu')->execute();
  98. }
  99. // 6.x-1.x cloned the entire link structure below the path 'admin' into a
  100. // separate 'menu_name' "admin_menu" with 'module' "admin_menu". 6.x-3.x and
  101. // early alpha versions of 7.x-3.x still did something similar. All of these
  102. // records are obsolete. Removal of the 'module' records (without different
  103. // menu_name) is particularly important, since they would otherwise appear
  104. // as duplicate links.
  105. db_delete('menu_links')
  106. ->condition(db_or()
  107. ->condition('module', 'admin_menu')
  108. ->condition('menu_name', 'admin_menu')
  109. )
  110. ->execute();
  111. }