8.2.x common.inc drupal_flush_all_caches()
8.0.x common.inc drupal_flush_all_caches()
8.1.x common.inc drupal_flush_all_caches()
8.3.x common.inc drupal_flush_all_caches()
6.x common.inc drupal_flush_all_caches()
7.x common.inc drupal_flush_all_caches()

Flush 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.

2 calls to drupal_flush_all_caches()
system_clear_cache_submit in modules/system/system.admin.inc
Submit callback; clear system caches.
update_finished in ./update.php

File

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

Code

function drupal_flush_all_caches() {
  // 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();

  // If invoked from update.php, we must not update the theme information in the
  // database, or this will result in all themes being disabled.
  if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update') {
    _system_theme_data();
  }
  else {
    system_theme_data();
  }

  drupal_rebuild_theme_registry();
  menu_rebuild();
  node_types_rebuild();
  // 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);
  }
}

Comments

mokaspar’s picture

my custom module creates images, which are cached on the disk. it works like the js/css-cache.
what is the right way, to make my module clear-cache aware? right now, i do alter the system-performance-settings form, so i get notified, when this button is pressed. is there a more generic way to accomplish this?