You are here

function _admin_menu_flush_cache in Administration menu 6.3

Same name and namespace in other branches
  1. 8.3 admin_menu.inc \_admin_menu_flush_cache()
  2. 7.3 admin_menu.inc \_admin_menu_flush_cache()

Flush all caches or a specific one.

Parameters

$name: (optional) Name of cache to flush.

See also

system_admin_menu_cache_info()

2 string references to '_admin_menu_flush_cache'
admin_menu_admin_menu_cache_info in ./admin_menu.inc
Implements hook_admin_menu_cache_info().
system_admin_menu_cache_info in ./admin_menu.inc
Implements hook_admin_menu_cache_info() on behalf of System module.

File

./admin_menu.inc, line 509
Menu builder functions for Administration menu.

Code

function _admin_menu_flush_cache($name = NULL) {
  switch ($name) {
    case 'admin_menu':

      // Flush cached menu tree.
      db_query("DELETE FROM {menu_links} WHERE menu_name = 'admin_menu' AND customized = 0");

    // Fall-through.
    case 'menu':
      menu_rebuild();
      break;
    case 'cache':

      // Don't clear cache_form - in-progress form submissions may break.
      // Ordered so clearing the page cache will always be the last action.
      // @see drupal_flush_all_caches()
      $core = array(
        'cache',
        'cache_block',
        'cache_filter',
        'cache_page',
      );
      $cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
      foreach ($cache_tables as $table) {
        cache_clear_all('*', $table, TRUE);
      }
      break;
    case 'assets':

      // Change query-strings on css/js files to enforce reload for all users.
      _drupal_flush_css_js();
      drupal_clear_css_cache();
      drupal_clear_js_cache();

      // Clear the page cache, since cached HTML pages might link to old CSS and
      // JS aggregates.
      cache_clear_all('*', 'cache_page', TRUE);
      break;
    case 'theme':
      module_invoke('system', 'theme_data');
      drupal_rebuild_theme_registry();
      break;
  }
}