You are here

function admin_tools_flush_cache in Admin Tools 6

Flush all caches or a specific one.

Parameters

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

1 string reference to 'admin_tools_flush_cache'
admin_tools_menu in ./admin_tools.module
Implementation of hook_menu().

File

./admin_tools.module, line 22

Code

function admin_tools_flush_cache($name = NULL) {
  switch ($name) {
    case 'menu':
      if (module_exists('views')) {
        views_invalidate_cache();
      }
      menu_rebuild();
      drupal_set_message('Menu Cache Cleared');
      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.
      $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);
      }
      drupal_set_message('Cache Tables Cleared');
      break;
    case 'requisites':

      // 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();
      drupal_set_message('CSS/JS Cache Cleared');
      break;
    case 'theme':
      module_invoke('system', 'theme_data');
      drupal_rebuild_theme_registry();
      drupal_set_message('Theme Registry Rebuilt');
      break;
    case 'views':
      views_flush_caches();
      drupal_set_message('Views Cache Cleared');
      break;
    default:

      // Flush all caches; no need to re-implement this.
      module_load_include('inc', 'system', 'system.admin');
      $form = $form_state = array();
      system_clear_cache_submit($form, $form_state);
      break;
  }
  drupal_goto();
}