diff --git a/includes/menu.inc b/includes/menu.inc index 18e91037e0..d4e55398ea 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -2752,11 +2752,14 @@ function _menu_check_rebuild() { * menu_execute_active_handler(), because the maintenance page environment * is different and leaves stale data in the menu tables. * + * @param $force + * Force a full rebuild even if {menu_router} didn't change. + * * @return * TRUE if the menu was rebuilt, FALSE if another thread was rebuilding * in parallel and the current thread just waited for completion. */ -function menu_rebuild() { +function menu_rebuild($force = FALSE) { if (!lock_acquire('menu_rebuild')) { // Wait for another request that is already doing this work. // We choose to block here since otherwise the router item may not @@ -2777,7 +2780,7 @@ function menu_rebuild() { try { list($menu, $masks) = menu_router_build(); - if (_menu_router_save($menu, $masks)) { + if (_menu_router_save($menu, $masks) || $force) { _menu_navigation_links_rebuild($menu); // Clear the menu, page and block caches. menu_cache_clear_all(); diff --git a/modules/simpletest/tests/menu.test b/modules/simpletest/tests/menu.test index f5d7d290fc..0d44d5999d 100644 --- a/modules/simpletest/tests/menu.test +++ b/modules/simpletest/tests/menu.test @@ -402,7 +402,7 @@ class MenuRouterTestCase extends DrupalWebTestCase { // Change the menu_name parameter in menu_test.module, then force a menu // rebuild. menu_test_menu_name('changed'); - menu_rebuild(); + menu_rebuild(TRUE); $sql = "SELECT menu_name FROM {menu_links} WHERE router_path = 'menu_name_test'"; $name = db_query($sql)->fetchField();