aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/cache.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2012-01-24 20:49:06 -0500
committerCash Costello <cash.costello@gmail.com>2012-01-24 20:49:06 -0500
commit54bef9fc0b85acaf6950e618bd02aa50befd2acc (patch)
tree338179e8632d3b09de532a7aea4278ebc555ed81 /engine/lib/cache.php
parentbe523eb86e6578030e022da4ff2143087a82eb67 (diff)
parenta2cfbdeb100324090ffe19d58aeb71c2def83ac8 (diff)
downloadelgg-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.php19
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