Commit 78dcd8e0 authored by Dries's avatar Dries
Browse files

- Patch #155621 by pwolanin: Use API function to delete menu links during rebuild.

parent 57750b90
...@@ -1423,8 +1423,13 @@ function _menu_navigation_links_rebuild($menu) { ...@@ -1423,8 +1423,13 @@ function _menu_navigation_links_rebuild($menu) {
} }
} }
$placeholders = implode(', ', array_fill(0, count($menu), "'%s'")); $placeholders = implode(', ', array_fill(0, count($menu), "'%s'"));
// Remove items if their router path does not exist any more. // Find any items where their router path does not exist any more.
db_query('DELETE FROM {menu_links} WHERE router_path NOT IN ('. $placeholders .')', array_keys($menu)); $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']);
}
} }
/** /**
......
Markdown is supported
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