diff options
author | Cash Costello <cash.costello@gmail.com> | 2012-01-24 20:49:06 -0500 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2012-01-24 20:49:06 -0500 |
commit | 54bef9fc0b85acaf6950e618bd02aa50befd2acc (patch) | |
tree | 338179e8632d3b09de532a7aea4278ebc555ed81 /engine/lib/cache.php | |
parent | be523eb86e6578030e022da4ff2143087a82eb67 (diff) | |
parent | a2cfbdeb100324090ffe19d58aeb71c2def83ac8 (diff) | |
download | elgg-54bef9fc0b85acaf6950e618bd02aa50befd2acc.tar.gz elgg-54bef9fc0b85acaf6950e618bd02aa50befd2acc.tar.bz2 |
Merge pull request #150 from cash/boot
Fixes #4317 cleans up the boot process
Diffstat (limited to 'engine/lib/cache.php')
-rw-r--r-- | engine/lib/cache.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/engine/lib/cache.php b/engine/lib/cache.php index e71ef332d..47c3af73c 100644 --- a/engine/lib/cache.php +++ b/engine/lib/cache.php @@ -352,3 +352,22 @@ function elgg_invalidate_simplecache() { return $return; } + +function elgg_cache_init() { + $viewtype = elgg_get_viewtype(); + + // Regenerate the simple cache if expired. + // Don't do it on upgrade because upgrade does it itself. + // @todo - move into function and perhaps run off init system event + if (!defined('UPGRADING')) { + $lastupdate = datalist_get("simplecache_lastupdate_$viewtype"); + $lastcached = datalist_get("simplecache_lastcached_$viewtype"); + if ($lastupdate == 0 || $lastcached < $lastupdate) { + elgg_regenerate_simplecache($viewtype); + $lastcached = datalist_get("simplecache_lastcached_$viewtype"); + } + $CONFIG->lastcache = $lastcached; + } +} + +elgg_register_event_handler('ready', 'system', 'elgg_cache_init');
\ No newline at end of file |