From 22444f2fedf0fbe34423128ede822adc0f82e411 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 26 Nov 2007 16:25:14 +0000 Subject: - Patch #195173 by Eaton et al: allow administrators to clear all caches. --- includes/common.inc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'includes') diff --git a/includes/common.inc b/includes/common.inc index 0b91ab5cc..b1c542207 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -3539,3 +3539,23 @@ function drupal_implode_tags($tags) { return implode(', ', $encoded_tags); } +/** + * Flush all cached data on the site. + * + * Empties cache tables, rebuilds the menu cache and theme registries, and + * exposes a hook for other modules to clear their own cache data as well. + */ +function drupal_flush_all_caches() { + drupal_clear_css_cache(); + drupal_clear_js_cache(); + 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); + } +} -- cgit v1.2.3