1.20.x common.inc backdrop_flush_all_caches()

Flushes all cached data on the site.

Empties cache tables, rebuilds the menu cache and theme registries, and invokes a hook so that other modules' cache data can be cleared as well.

File

includes/common.inc, line 8352
Common functions that many Backdrop modules will need to reference.

Code

function backdrop_flush_all_caches() {
  // Change query-strings on css/js files to enforce reload for all users.
  _backdrop_flush_css_js();

  system_rebuild_module_data();
  backdrop_clear_css_cache();
  backdrop_clear_js_cache();

  // Rebuild the theme data.
  system_rebuild_theme_data();
  backdrop_theme_rebuild();

  entity_info_cache_clear();

  // node_menu() defines menu items based on node types so it needs to come
  // after node types are rebuilt.
  menu_rebuild();

  // Ordered so clearing the page cache will always be the last action.
  $core = array('cache', 'path', 'filter', 'bootstrap', 'token', 'page');
  $cache_bins = array_merge(module_invoke_all('flush_caches'), $core);
  foreach ($cache_bins as $bin) {
    cache($bin)->flush();
  }

  // Rebuild the bootstrap module list. We do this here so that developers
  // can get new hook_boot() implementations registered without having to
  // write a hook_update_N() function.
  _system_update_bootstrap_status();
}