diff --git a/includes/menu.inc b/includes/menu.inc index fa5a71e..53b41ee 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -2712,6 +2712,23 @@ function menu_rebuild() { // We choose to block here since otherwise the router item may not // be available in menu_execute_active_handler() resulting in a 404. lock_wait('menu_rebuild'); + + // Another process has built the menu for us, however, there are + // still cache loaded variables in this processes that think we + // need to rebuild the menu. So before we return, lets alter those + // variables for this process only (no writes to the database). + global $conf; + if (isset($conf['menu_rebuild_needed'])) { + unset($conf['menu_rebuild_needed']); + } + + // The menu_masks variable needs to be put into the local + // variables array $conf to prevent rebulding in this process. + // We can read this out of the updated variables table. + $menu_masks_data = db_query('SELECT value FROM {variable} WHERE name = :name', array(':name' => 'menu_masks'))->fetchField(); + if ($menu_masks_data) { + $conf['menu_masks'] = unserialize($menu_masks_data); + } return FALSE; }