1 admin_bar.inc admin_bar_flush_cache($name = NULL)

Flush all caches or a specific one.

Parameters

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

File

core/modules/admin_bar/admin_bar.inc, line 893
Menu builder functions for Administration bar.

Code

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

  backdrop_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 home page.
  backdrop_goto();
}