function admin_menu_flush_cache

nittany7 admin_menu.inc admin_menu_flush_cache($name = NULL)
cis7 admin_menu.inc admin_menu_flush_cache($name = NULL)
mooc7 admin_menu.inc admin_menu_flush_cache($name = NULL)

Flush all caches or a specific one.

Parameters

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

1 string reference to 'admin_menu_flush_cache'
admin_menu_menu in modules/contrib/admin_menu/admin_menu.module
Implements hook_menu().

File

modules/contrib/admin_menu/admin_menu.inc, line 880
Menu builder functions for Administration menu.

Code

function admin_menu_flush_cache($name = NULL) {
  if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], current_path())) {
    return MENU_ACCESS_DENIED;
  }
  if (isset($name)) {
    $caches = module_invoke_all('admin_menu_cache_info');
    if (!isset($caches[$name])) {
      return MENU_NOT_FOUND;
    }
  }
  else {
    $caches[$name] = array(
      'title' => t('Every'),
      'callback' => 'drupal_flush_all_caches',
    );
  }
  // Pass the cache to flush forward to the callback.
  $function = $caches[$name]['callback'];
  $function($name);

  drupal_set_message(t('!title cache cleared.', array('!title' => $caches[$name]['title'])));

  // The JavaScript injects a destination request parameter pointing to the
  // originating page, so the user is redirected back to that page. Without
  // destination parameter, the redirect ends on the front page.
  drupal_goto();
}