summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-07-05 18:30:04 +0000
committerDries Buytaert <dries@buytaert.net>2008-07-05 18:30:04 +0000
commitaf24fca8e9d2496354966925f8c604fd8238d52b (patch)
tree7f1d3f4ceca664fdc07a03bec3672f38a8609906 /includes
parent4fe1f3582cba1f9f327c5f9c0206ee4c7c168185 (diff)
downloadbrdo-af24fca8e9d2496354966925f8c604fd8238d52b.tar.gz
brdo-af24fca8e9d2496354966925f8c604fd8238d52b.tar.bz2
- Patch #238760 by pwolanin, Damien, boydjd: reduce race condition in menu rebuilding.
Diffstat (limited to 'includes')
-rw-r--r--includes/menu.inc7
1 files changed, 5 insertions, 2 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index 12cf90d51..a94beb298 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -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;
}