aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/cache.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2012-01-21 10:44:47 -0500
committerCash Costello <cash.costello@gmail.com>2012-01-21 10:44:47 -0500
commita2cfbdeb100324090ffe19d58aeb71c2def83ac8 (patch)
treeed6b95ea6f9e21101fc467ffe02caaea3eda5975 /engine/lib/cache.php
parentb6284c6e781275e7d545778fb9ae41ba9107bdaa (diff)
downloadelgg-a2cfbdeb100324090ffe19d58aeb71c2def83ac8.tar.gz
elgg-a2cfbdeb100324090ffe19d58aeb71c2def83ac8.tar.bz2
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