diff --git a/includes/menu.inc b/includes/menu.inc index 5582c45..43b22ce 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -2689,11 +2689,16 @@ function _menu_link_build($item) { function _menu_navigation_links_rebuild($menu) { // Add normal and suggested items as links. $menu_links = array(); + $menu_drop = array(); foreach ($menu as $path => $item) { if ($item['_visible']) { $menu_links[$path] = $item; $sort[$path] = $item['_number_parts']; } + // Identify MENU_CALLBACK items; used to discard records in menu_links. + if ($item['type'] === MENU_CALLBACK) { + $menu_drop[$path] = $item; + } } if ($menu_links) { // Keep an array of processed menu links, to allow menu_link_save() to @@ -2767,10 +2772,12 @@ function _menu_navigation_links_rebuild($menu) { ->execute(); } } - // Find any item whose router path does not exist any more. + // Find any item whose router path does not exist any more OR which has + // become a MENU_CALLBACK and needs deletion from the menu_links table. + $paths_drop = array_keys($menu_drop); $result = db_select('menu_links') ->fields('menu_links') - ->condition('router_path', $paths, 'NOT IN') + ->condition(db_or()->condition('router_path', $paths, 'NOT IN')->condition('router_path',$paths_drop, 'IN')) ->condition('external', 0) ->condition('updated', 0) ->condition('customized', 0)