summaryrefslogtreecommitdiff
path: root/modules/system/system.module
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2016-02-01 23:35:16 -0500
committerDavid Rothstein <drothstein@gmail.com>2016-02-01 23:35:16 -0500
commite6e00e8444caa3dce647ce46b01256084ce2048c (patch)
treea6934f13afc88567127a3b2604dc2a1ef1809d2e /modules/system/system.module
parent11e18568f951cb431b0e0e6514767f2516e0d75b (diff)
downloadbrdo-e6e00e8444caa3dce647ce46b01256084ce2048c.tar.gz
brdo-e6e00e8444caa3dce647ce46b01256084ce2048c.tar.bz2
Issue #1191290 by klausi, David_Rothstein, Fabianx: system_cron() should not invoke hook_flush_caches() on every cron run
Diffstat (limited to 'modules/system/system.module')
-rw-r--r--modules/system/system.module16
1 files changed, 14 insertions, 2 deletions
diff --git a/modules/system/system.module b/modules/system/system.module
index 39de758ed..362bdd445 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -3056,8 +3056,20 @@ function system_cron() {
}
}
- $core = array('cache', 'cache_path', 'cache_filter', 'cache_page', 'cache_form', 'cache_menu');
- $cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
+ // Delete expired cache entries.
+ // Avoid invoking hook_flush_cashes() on every cron run because some modules
+ // use this hook to perform expensive rebuilding operations (which are only
+ // designed to happen on full cache clears), rather than just returning a
+ // list of cache tables to be cleared.
+ $cache_object = cache_get('system_cache_tables');
+ if (empty($cache_object)) {
+ $core = array('cache', 'cache_path', 'cache_filter', 'cache_page', 'cache_form', 'cache_menu');
+ $cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
+ cache_set('system_cache_tables', $cache_tables);
+ }
+ else {
+ $cache_tables = $cache_object->data;
+ }
foreach ($cache_tables as $table) {
cache_clear_all(NULL, $table);
}