menu_rebuild

Definition

menu_rebuild()
includes/menu.inc, line 1650

Description

(Re)populate the database tables used by various menu functions.

This function will clear and populate the {menu_router} table, add entries to {menu_links} for new router items, then remove stale items from {menu_links}. If called from update.php or install.php, it will also schedule a call to itself on the first real page load from menu_execute_active_handler(), because the maintenance page environment is different and leaves stale data in the menu tables.

Related topics

Namesort iconDescription
Menu systemDefine the navigation menus, and route page requests to code based on URLs.

Code

<?php
function menu_rebuild() {
  variable_del('menu_rebuild_needed');
  menu_cache_clear_all();
  $menu = menu_router_build(TRUE);
  _menu_navigation_links_rebuild($menu);
  // Clear the page and block caches.
  _menu_clear_page_cache();
  if (defined('MAINTENANCE_MODE')) {
    variable_set('menu_rebuild_needed', TRUE);
  }
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.