summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-08-19 09:46:15 +0000
committerDries Buytaert <dries@buytaert.net>2007-08-19 09:46:15 +0000
commit78dcd8e03f7dcfc8c7cb06d5f824dd6170806e99 (patch)
treed572752a57e59c810988c20f74503ca580f86321 /includes
parent57750b90fc2233554c4d4020e10bc61b78713d73 (diff)
downloadbrdo-78dcd8e03f7dcfc8c7cb06d5f824dd6170806e99.tar.gz
brdo-78dcd8e03f7dcfc8c7cb06d5f824dd6170806e99.tar.bz2
- Patch #155621 by pwolanin: Use API function to delete menu links during rebuild.
Diffstat (limited to 'includes')
-rw-r--r--includes/menu.inc9
1 files changed, 7 insertions, 2 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index 105697465..d45054c57 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -1423,8 +1423,13 @@ function _menu_navigation_links_rebuild($menu) {
}
}
$placeholders = implode(', ', array_fill(0, count($menu), "'%s'"));
- // Remove items if their router path does not exist any more.
- db_query('DELETE FROM {menu_links} WHERE router_path NOT IN ('. $placeholders .')', array_keys($menu));
+ // Find any items where their router path does not exist any more.
+ $result = db_query('SELECT mlid FROM {menu_links} WHERE router_path NOT IN ('. $placeholders .') AND external = 0 ORDER BY depth DESC', array_keys($menu));
+ // Remove all such items. Starting from those with the greatest depth will
+ // minimize the amount of re-parenting done by menu_link_delete().
+ while ($item = db_fetch_array($result)) {
+ menu_link_delete($item['mlid']);
+ }
}
/**