diff options
author | Dries Buytaert <dries@buytaert.net> | 2007-11-26 16:25:14 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2007-11-26 16:25:14 +0000 |
commit | 22444f2fedf0fbe34423128ede822adc0f82e411 (patch) | |
tree | 54b19c132bf4dfb96cacc9e3309f915272bfa189 /includes | |
parent | 58852d4b7b72113793455b92bf113359e849e2fb (diff) | |
download | brdo-22444f2fedf0fbe34423128ede822adc0f82e411.tar.gz brdo-22444f2fedf0fbe34423128ede822adc0f82e411.tar.bz2 |
- Patch #195173 by Eaton et al: allow administrators to clear all caches.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 20 |
1 files changed, 20 insertions, 0 deletions
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); + } +} |