_menu_clear_page_cache

Versions
6 – 7
_menu_clear_page_cache()

Helper function to clear the page and block caches at most twice per page load.

Related topics

▾ 3 functions call _menu_clear_page_cache()

menu_link_save in includes/menu.inc
Save a menu link.
menu_rebuild in includes/menu.inc
(Re)populate the database tables used by various menu functions.
_menu_delete_item in includes/menu.inc
Helper function for menu_link_delete; deletes a single menu link.

Code

includes/menu.inc, line 2034

<?php
function _menu_clear_page_cache() {
  static $cache_cleared = 0;

  // Clear the page and block caches, but at most twice, including at
  //  the end of the page load when there are multple links saved or deleted.
  if (empty($cache_cleared)) {
    cache_clear_all();
    // Keep track of which menus have expanded items.
    _menu_set_expanded_menus();
    $cache_cleared = 1;
  }
  elseif ($cache_cleared == 1) {
    register_shutdown_function('cache_clear_all');
    // Keep track of which menus have expanded items.
    register_shutdown_function('_menu_set_expanded_menus');
    $cache_cleared = 2;
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.