diff -urp ./admin_menu.inc ../admin_menu.patched/admin_menu.inc
--- ./admin_menu.inc 2010-03-11 14:28:47.000000000 +1100
+++ ../admin_menu.patched/admin_menu.inc 2010-10-31 14:10:00.000000000 +1100
@@ -422,9 +422,9 @@ function _admin_menu_developer_modules()
*/
function admin_menu_flush_cache($name = NULL) {
switch ($name) {
- case 'admin_menu':
+ case 'menu-management':
// Flush cached menu tree.
- db_query("DELETE FROM {menu_links} WHERE menu_name = 'admin_menu' AND customized = 0");
+ db_query("DELETE FROM {menu_links} WHERE menu_name = 'menu-management' AND customized = 0");
// Fall-through.
case 'menu':
diff -urp ./admin_menu.module ../admin_menu.patched/admin_menu.module
--- ./admin_menu.module 2010-08-01 01:13:55.000000000 +1000
+++ ../admin_menu.patched/admin_menu.module 2010-10-31 14:10:00.000000000 +1100
@@ -117,7 +117,7 @@ function admin_menu_menu_alter(&$items)
if ($item['type'] & MENU_IS_LOCAL_TASK) {
$items[$path]['_visible'] = TRUE;
}
- $items[$path]['menu_name'] = 'admin_menu';
+ $items[$path]['menu_name'] = 'menu-management';
}
}
/*
@@ -125,7 +125,7 @@ function admin_menu_menu_alter(&$items)
elseif (strpos($path, 'node/add') === 0) {
$newpath = 'admin/' . $path;
$items[$newpath] = admin_menu_copy_item($item, $path, $newpath);
- $items[$newpath]['menu_name'] = 'admin_menu';
+ $items[$newpath]['menu_name'] = 'menu-management';
if ($newpath == 'admin/node/add') {
$items[$newpath]['weight'] = -15;
}
@@ -134,7 +134,7 @@ function admin_menu_menu_alter(&$items)
}
// Remove 'admin', so children appear on the top-level.
- $items['admin']['menu_name'] = 'admin_menu';
+ $items['admin']['menu_name'] = 'menu-management';
// Remove local tasks on 'admin'.
$items['admin/by-task']['_visible'] = FALSE;
$items['admin/by-module']['_visible'] = FALSE;
@@ -148,7 +148,7 @@ function admin_menu_menu_alter(&$items)
// those are moved back into the administration menu, then the menu system
// will not calculate/assign the proper menu link parents when the parent item
// (here: 'admin') is marked as customized.
- db_query("UPDATE {menu_links} SET menu_name = 'admin_menu', customized = 0 WHERE router_path = 'admin'");
+ db_query("UPDATE {menu_links} SET menu_name = 'menu-management', customized = 0 WHERE router_path = 'admin'");
// Flush client-side caches whenever the menu is rebuilt.
admin_menu_flush_caches();
@@ -192,7 +192,7 @@ function admin_menu_menu_link_alter(&$it
// @todo Temporary fix until #550254 has been released.
// @see menu_link_save()
// Only process links during menu router rebuild, belonging to our menu.
- if (!isset($menu) || !($item['menu_name'] == 'admin_menu')) {
+ if (!isset($menu) || !($item['menu_name'] == 'menu-management')) {
return;
}
@@ -267,7 +267,7 @@ function admin_menu_init() {
// administrative pages.
// @see admin_menu_menu_alter()
if (arg(0) == 'admin') {
- menu_set_active_menu_name('admin_menu');
+ menu_set_active_menu_name('menu-management');
}
if (!user_access('access administration menu') || admin_menu_suppress(FALSE)) {
@@ -291,7 +291,7 @@ function admin_menu_init() {
$settings['destination'] = drupal_get_destination();
// Hash for client-side HTTP/AJAX caching.
- $cid = 'admin_menu:' . $user->uid . ':' . $language->language;
+ $cid = 'menu-management:' . $user->uid . ':' . $language->language;
if (!empty($_COOKIE['has_js']) && ($hash = admin_menu_cache_get($cid))) {
$settings['hash'] = $hash;
// The base path to use for cache requests depends on whether clean URLs
@@ -492,7 +492,7 @@ function admin_menu_output() {
global $user, $language;
$cache_server_enabled = variable_get('admin_menu_cache_server', TRUE);
- $cid = 'admin_menu:' . $user->uid . ':' . $language->language;
+ $cid = 'menu-management:' . $user->uid . ':' . $language->language;
// Do nothing at all here if the client supports client-side caching, the user
// has a hash, and is NOT requesting the cache update path. Consult the hash
@@ -528,7 +528,7 @@ function admin_menu_output() {
module_load_include('inc', 'admin_menu');
// Add administration menu.
- $content['menu'] = admin_menu_links_menu(menu_tree_all_data('admin_menu'));
+ $content['menu'] = admin_menu_links_menu(menu_tree_all_data('menu-management'));
$content['menu']['#theme'] = 'admin_menu_links';
// Ensure the menu tree is rendered between the icon and user links.
$content['menu']['#weight'] = 0;
@@ -679,7 +679,7 @@ function admin_menu_translated_menu_link
global $user, $base_url;
static $access_all;
- if ($item['menu_name'] != 'admin_menu') {
+ if ($item['menu_name'] != 'menu-management') {
return;
}
@@ -714,7 +714,7 @@ function admin_menu_translated_menu_link
*/
function admin_menu_flush_caches() {
// Flush cached output of admin_menu.
- cache_clear_all('admin_menu:', 'cache_menu', TRUE);
+ cache_clear_all('menu-management:', 'cache_menu', TRUE);
// Flush client-side cache hashes.
// db_table_exists() required for SimpleTest.
if (db_table_exists('cache_admin_menu')) {
diff -urp ./admin_menu.install ../admin_menu.patched/admin_menu.install
--- ./admin_menu.install 2010-02-19 20:43:05.000000000 +0000
+++ ../admin_menu.patched/admin_menu.install 2010-10-31 14:10:00.000000000 +0000
@@ -52,10 +52,15 @@ function admin_menu_uninstall()
* Helper function to ensure 'admin_menu' menu.
*/
function _admin_menu_install_menu() {
- if (db_result(db_query("SELECT menu_name FROM {menu_custom} WHERE menu_name = 'admin_menu'"))) {
- return array('success' => TRUE, 'query' => 'Menu for Administration menu already exists.');
+ if (db_result(db_query("SELECT menu_name FROM {menu_custom} WHERE menu_name = 'menu-management'"))) {
+ $ret = array();
+ // Change menu title and description in case a user has already added the same menu
+ $ret[] = update_sql("UPDATE {menu_custom} SET `title` = 'Management', `description` = 'The Management menu contains links for administrative tasks.' WHERE `menu_name` = 'menu-management'");
+ $ret[] = array('success' => TRUE, 'query' => 'Menu for Administration menu already exists.');
+ return $ret;
}
- return update_sql("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('admin_menu', 'Administration menu', '')");
+ // Add the menu if it hasn't been added yet
+ return update_sql("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('menu-management', 'Management', 'The Management menu contains links for administrative tasks.')");
}
/**
@@ -127,3 +132,28 @@ function admin_menu_update_6302()
return $ret;
}
+/**
+ * Rename menus (admin_menu to menu-management).
+ *
+ * @see admin_menu_install()
+ */
+function admin_menu_update_6303() {
+ $ret = array();
+ if ((db_result(db_query("SELECT menu_name FROM {menu_custom} WHERE menu_name = 'menu-management'"))) && (db_result(db_query("SELECT menu_name FROM {menu_custom} WHERE menu_name = 'admin_menu'")))) {
+ // Remove existing menu in case a user has already added the same menu
+ $ret[] = update_sql("DELETE FROM {menu_custom} WHERE menu_name = 'menu-management'");
+ // Rename the menu from older versions
+ $ret[] = update_sql("UPDATE {menu_custom} SET `menu_name` = 'menu-management', `title` = 'Management', `description` = 'The Management menu contains links for administrative tasks.' WHERE `menu_name` = 'admin_menu'");
+ }
+ elseif ((db_result(db_query("SELECT menu_name FROM {menu_custom} WHERE menu_name = 'menu-management'"))) && (!db_result(db_query("SELECT menu_name FROM {menu_custom} WHERE menu_name = 'admin_menu'")))) {
+ // Change menu title and description in case a user has already added the same menu
+ $ret[] = update_sql("UPDATE {menu_custom} SET `title` = 'Management', `description` = 'The Management menu contains links for administrative tasks.' WHERE `menu_name` = 'menu-management'");
+ }
+ elseif (!db_result(db_query("SELECT menu_name FROM {menu_custom} WHERE menu_name = 'menu-management'")) && db_result(db_query("SELECT menu_name FROM {menu_custom} WHERE menu_name = 'admin_menu'"))) {
+ // Rename the menu from older versions
+ $ret[] = update_sql("UPDATE {menu_custom} SET `menu_name` = 'menu-management', `title` = 'Management', `description` = 'The Management menu contains links for administrative tasks.' WHERE `menu_name` = 'admin_menu'");
+ }
+ // Update menu links from earlier versions.
+ $ret[] = update_sql("UPDATE {menu_links} SET `menu_name` = 'menu-management' WHERE module = 'admin_menu' OR menu_name = 'admin_menu'");
+ return $ret;
+}
Only in .: diff.patch