diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-08-20 18:15:05 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-08-20 18:15:05 +0000 |
commit | 85509811e1be9e8695f07f83af64c4ed8d4e9e36 (patch) | |
tree | 1d5a9bea28c69bfd93bb351d4d7aa74e19d09054 /includes | |
parent | f4dc86046fb54ec44339eb33f68538fc8019c1b0 (diff) | |
download | brdo-85509811e1be9e8695f07f83af64c4ed8d4e9e36.tar.gz brdo-85509811e1be9e8695f07f83af64c4ed8d4e9e36.tar.bz2 |
#155621 follow up patch by pwolanin: really delete menu links by refreshing the cache
Diffstat (limited to 'includes')
-rw-r--r-- | includes/menu.inc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/includes/menu.inc b/includes/menu.inc index 8f9786d3a..9872e44b0 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -1424,11 +1424,11 @@ function _menu_navigation_links_rebuild($menu) { } $placeholders = implode(', ', array_fill(0, count($menu), "'%s'")); // Find any items where their router path does not exist any more. - $result = db_query('SELECT mlid FROM {menu_links} WHERE router_path NOT IN ('. $placeholders .') AND external = 0 ORDER BY depth DESC', array_keys($menu)); + $result = db_query('SELECT * FROM {menu_links} WHERE router_path NOT IN ('. $placeholders .') AND external = 0 ORDER BY depth DESC', array_keys($menu)); // Remove all such items. Starting from those with the greatest depth will // minimize the amount of re-parenting done by menu_link_delete(). while ($item = db_fetch_array($result)) { - menu_link_delete($item['mlid']); + _menu_delete_item($item, TRUE); } } @@ -1455,9 +1455,9 @@ function menu_link_delete($mlid, $path = NULL) { /** * Helper function for menu_link_delete; deletes a single menu link. */ -function _menu_delete_item($item) { - // System-created items get automatically deleted, but only on menu rebuild. - if ($item && $item['module'] != 'system') { +function _menu_delete_item($item, $rebuild = FALSE) { + // System-created items are only deleted on menu rebuild. + if ($item && ($item['module'] != 'system' || $rebuild)) { // Children get re-attached to the item's parent. if ($item['has_children']) { @@ -1473,7 +1473,10 @@ function _menu_delete_item($item) { // Update the has_children status of the parent. _menu_update_parental_status($item); - menu_cache_clear($item['menu_name']); + // If we are rebuilding the menu, the menu cache has already been cleared. + if (!$rebuild) { + menu_cache_clear($item['menu_name']); + } } } |