=== modified file 'includes/menu.inc' --- includes/menu.inc 2007-12-06 09:58:30 +0000 +++ includes/menu.inc 2007-12-06 19:45:41 +0000 @@ -1598,11 +1598,13 @@ function _menu_navigation_links_rebuild( } } } - $result = db_query("SELECT ml.link_path, ml.mlid, ml.router_path FROM {menu_links} ml WHERE ml.updated = 1"); + $result = db_query("SELECT ml.link_path, ml.mlid, ml.router_path, ml.updated FROM {menu_links} ml WHERE ml.updated = 1"); while ($item = db_fetch_array($result)) { $router_path = _menu_find_router_path($menu, $item['link_path']); - if (!empty($router_path) && $router_path != $item['router_path']) { - db_query("UPDATE {menu_links} SET router_path = '%s' WHERE mlid = %d", $router_path, $item['mlid']); + if (!empty($router_path) && ($router_path != $item['router_path'] || $item['updated'])) { + // If the router path and the link path matches, it's surely a working + // item, so we clear the updated flag. + db_query("UPDATE {menu_links} SET router_path = '%s', updated = %d WHERE mlid = %d", $router_path, $router_path != $item['link_path'], $item['mlid']); } } } @@ -1631,9 +1633,9 @@ function menu_link_delete($mlid, $path = * Helper function for menu_link_delete; deletes a single menu link. */ function _menu_delete_item($item) { - // System-created items are never deleted. - if ($item && ($item['module'] != 'system')) { - + // System-created items are never deleted. Updated items are an exception, + // as they can be broken. + if ($item && ($item['module'] != 'system' || $item['updated'])) { // Children get re-attached to the item's parent. if ($item['has_children']) { $result = db_query("SELECT mlid FROM {menu_links} WHERE plid = %d", $item['mlid']); === modified file 'modules/menu/menu.admin.inc' --- modules/menu/menu.admin.inc 2007-12-06 10:37:47 +0000 +++ modules/menu/menu.admin.inc 2007-12-06 17:53:02 +0000 @@ -95,7 +95,7 @@ function _menu_overview_tree_form($tree) $operations = array(); $operations['edit'] = l(t('edit'), 'admin/build/menu/item/'. $item['mlid'] .'/edit'); // Only items created by the menu module can be deleted. - if ($item['module'] == 'menu') { + if ($item['module'] == 'menu' || $item['updated'] == 1) { $operations['delete'] = l(t('delete'), 'admin/build/menu/item/'. $item['mlid'] .'/delete'); } // Set the reset column. @@ -534,8 +534,9 @@ function menu_edit_menu_submit($form, &$ * Menu callback; Check access and present a confirm form for deleting a menu link. */ function menu_item_delete_page($item) { - // Links defined via hook_menu may not be deleted. - if ($item['module'] == 'system') { + // Links defined via hook_menu may not be deleted. Updated items are an + // exception, as they can be broken. + if ($item['module'] == 'system' && !$item['updated']) { drupal_access_denied(); return; } === modified file 'modules/system/system.install' --- modules/system/system.install 2007-12-04 16:39:22 +0000 +++ modules/system/system.install 2007-12-06 19:56:42 +0000 @@ -2327,11 +2327,6 @@ function system_update_6021() { } if ($_SESSION['system_update_6021'] >= $_SESSION['system_update_6021_max']) { - $result = db_query('SELECT * FROM {menu_links} WHERE updated = 1 AND has_children = 0 AND customized = 0 ORDER BY depth DESC'); - // Remove all items that are not customized. - while ($item = db_fetch_array($result)) { - _menu_delete_item($item, TRUE); - } if (!empty($_SESSION['menu_bogus_menus'])) { // Remove entries in bogus menus. This is secure because we deleted // every non-alpanumeric character from the menu name.