Commit af24fca8 authored by Dries's avatar Dries
Browse files

- Patch #238760 by pwolanin, Damien, boydjd: reduce race condition in menu rebuilding.

parent 4fe1f358
......@@ -1718,7 +1718,6 @@ function menu_router_build($reset = FALSE) {
$menu = $cache->data;
}
else {
db_query('DELETE FROM {menu_router}');
// We need to manually call each module so that we can know which module
// a given item came from.
$callbacks = array();
......@@ -1734,7 +1733,6 @@ function menu_router_build($reset = FALSE) {
// Alter the menu as defined in modules, keys are like user/%user.
drupal_alter('menu', $callbacks);
$menu = _menu_router_build($callbacks);
cache_set('router:', $menu, 'cache_menu');
}
}
return $menu;
......@@ -2314,6 +2312,10 @@ function _menu_router_build($callbacks) {
}
array_multisort($sort, SORT_NUMERIC, $menu);
if ($menu) {
// Delete the existing router since we have some data to replace it.
db_query('DELETE FROM {menu_router}');
}
// Apply inheritance rules.
foreach ($menu as $path => $v) {
$item = &$menu[$path];
......@@ -2401,6 +2403,7 @@ function _menu_router_build($callbacks) {
$masks = array_keys($masks);
rsort($masks);
variable_set('menu_masks', $masks);
cache_set('router:', $menu, 'cache_menu');
return $menu;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment