function admin_menu_flush_caches

nittany7 admin_menu.module admin_menu_flush_caches($uid = NULL)
cis7 admin_menu.module admin_menu_flush_caches($uid = NULL)
mooc7 admin_menu.module admin_menu_flush_caches($uid = NULL)

Implements hook_flush_caches().

Flushes client-side caches.

Parameters

int $uid: (optional) A user ID to limit the cache flush to.

7 calls to admin_menu_flush_caches()
admin_menu_form_alter_flush_cache_submit in modules/contrib/admin_menu/admin_menu.module
Form submission handler to flush Administration menu caches.
admin_menu_menu_alter in modules/contrib/admin_menu/admin_menu.module
Implements hook_menu_alter().
admin_menu_menu_link_delete in modules/contrib/admin_menu/admin_menu.module
Implements hook_menu_link_delete().
admin_menu_menu_link_insert in modules/contrib/admin_menu/admin_menu.module
Implements hook_menu_link_insert().
admin_menu_menu_link_update in modules/contrib/admin_menu/admin_menu.module
Implements hook_menu_link_update().

... See full list

File

modules/contrib/admin_menu/admin_menu.module, line 779
Render an administrative menu as a dropdown menu at the top of the window.

Code

function admin_menu_flush_caches($uid = NULL) {
  // A call to menu_rebuild() will trigger potentially thousands of calls into
  // menu_link_save(), for which admin_menu has to implement the corresponding
  // CRUD hooks, in order to take up any menu link changes, since any menu link
  // change could affect the admin menu (which essentially is an aggregate) and
  // since there is no other way to get notified about stale caches. The cache
  // only needs to be flushed once though, so we prevent a ton of needless
  // subsequent calls with this static.
  // @see http://drupal.org/node/918538
  $was_flushed = &drupal_static(__FUNCTION__, array());
  // $uid can be NULL. PHP automatically converts that into '' (empty string),
  // which is different to uid 0 (zero).
  if (isset($was_flushed[$uid])) {
    return;
  }
  $was_flushed[$uid] = TRUE;

  $cid = 'admin_menu:';
  if (isset($uid)) {
    $cid .= $uid . ':';
  }
  // Flush cached output of admin_menu.
  cache_clear_all($cid, 'cache_menu', TRUE);
  // Flush client-side cache hashes.
  drupal_static_reset('admin_menu_cache_get');
  // db_table_exists() required for SimpleTest.
  if (db_table_exists('cache_admin_menu')) {
    cache_clear_all(isset($uid) ? $cid : '*', 'cache_admin_menu', TRUE);
  }
}