2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
@@ -1694,15 +1694,27 @@ function _menu_navigation_links_rebuild($menu) {
...
@@ -1694,15 +1694,27 @@ function _menu_navigation_links_rebuild($menu) {
}
}
}
}
}
}
$result=db_query("SELECT ml.link_path, ml.mlid, ml.router_path, ml.updated FROM {menu_links} ml WHERE ml.updated = 1");
$placeholders=db_placeholders($menu,'varchar');
$paths=array_keys($menu);
// Updated items and customized items which router paths are gone need new
// router paths.
$result=db_query("SELECT ml.link_path, ml.mlid, ml.router_path, ml.updated FROM {menu_links} ml WHERE ml.updated = 1 OR (router_path NOT IN ($placeholders) AND external = 0 AND customized = 1)",$paths);
db_query("UPDATE {menu_links} SET router_path = '%s', updated = %d WHERE mlid = %d",$router_path,$updated,$item['mlid']);
}
}
}
}
// Find any items where their router path does not exist any more.
$result=db_query('SELECT * FROM {menu_links} WHERE router_path NOT IN ('.$placeholders.') AND external = 0 AND updated = 0 AND customized = 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_delete_item($item,TRUE);
}
}
}
/**
/**
...
@@ -1727,11 +1739,14 @@ function menu_link_delete($mlid, $path = NULL) {
...
@@ -1727,11 +1739,14 @@ function menu_link_delete($mlid, $path = NULL) {
/**
/**
* Helper function for menu_link_delete; deletes a single menu link.
* Helper function for menu_link_delete; deletes a single menu link.
*
* @param $item
* Item to be deleted.
* @param $force
* Forces deletion. Internal use only, setting to TRUE is discouraged.
*/
*/
function_menu_delete_item($item){
function_menu_delete_item($item,$force=FALSE){
// System-created items are never deleted. Updated items are an exception,