From ccdeae8d81f37e556047099bbfc361cb0d75d818 Mon Sep 17 00:00:00 2001
From: Angie Byron <webchick@24967.no-reply.drupal.org>
Date: Mon, 22 Sep 2008 03:19:43 +0000
Subject: [PATCH] #238760 follow-up by pwolanin: Forward-port rest of 6.x fix
 for menu_rebuild() race condition.

---
 includes/menu.inc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/includes/menu.inc b/includes/menu.inc
index d5e45a0c51e2..312812aa06b0 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -2340,10 +2340,11 @@ 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}');
+  if (!$menu) {
+    return array();
   }
+  // 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];
-- 
GitLab