aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/cache.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/cache.php')
-rw-r--r--engine/lib/cache.php47
1 files changed, 19 insertions, 28 deletions
diff --git a/engine/lib/cache.php b/engine/lib/cache.php
index b329c58ec..c117b9ec9 100644
--- a/engine/lib/cache.php
+++ b/engine/lib/cache.php
@@ -369,7 +369,7 @@ function elgg_invalidate_simplecache() {
$return = true;
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
- $return = $return && unlink($CONFIG->dataroot . 'views_simplecache/' . $file);
+ $return &= unlink($CONFIG->dataroot . 'views_simplecache/' . $file);
}
}
closedir($handle);
@@ -382,8 +382,8 @@ function elgg_invalidate_simplecache() {
}
foreach ($viewtypes as $viewtype) {
- $return = $return && datalist_set("simplecache_lastupdate_$viewtype", 0);
- $return = $return && datalist_set("simplecache_lastcached_$viewtype", 0);
+ $return &= datalist_set("simplecache_lastupdate_$viewtype", 0);
+ $return &= datalist_set("simplecache_lastcached_$viewtype", 0);
}
return $return;
@@ -395,26 +395,23 @@ function elgg_invalidate_simplecache() {
*/
function _elgg_load_cache() {
global $CONFIG;
+
+ $CONFIG->system_cache_loaded = false;
+
+ $CONFIG->views = new stdClass();
+ $data = elgg_load_system_cache('view_locations');
+ if (!is_string($data)) {
+ return;
+ }
+ $CONFIG->views->locations = unserialize($data);
- $result = true;
- $cache_types = array(
- 'view_paths' => 'views',
- 'view_types' => 'view_types',
- );
- $data = array();
- foreach ($cache_types as $type => $var_name) {
- $data[$var_name] = elgg_load_system_cache($type);
- $result = $result && is_string($data[$var_name]);
+ $data = elgg_load_system_cache('view_types');
+ if (!is_string($data)) {
+ return;
}
+ $CONFIG->view_types = unserialize($data);
- if ($result) {
- $CONFIG->system_cache_loaded = true;
- foreach ($data as $name => $value) {
- $CONFIG->$name = unserialize($value);
- }
- } else {
- $CONFIG->system_cache_loaded = false;
- }
+ $CONFIG->system_cache_loaded = true;
}
/**
@@ -440,14 +437,8 @@ function _elgg_cache_init() {
// cache system data if enabled and not loaded
if ($CONFIG->system_cache_enabled && !$CONFIG->system_cache_loaded) {
- $cache_types = array(
- 'view_paths' => 'views',
- 'view_types' => 'view_types',
- );
- $data = array();
- foreach ($cache_types as $type => $var_name) {
- elgg_save_system_cache($type, serialize($CONFIG->$var_name));
- }
+ elgg_save_system_cache('view_locations', serialize($CONFIG->views->locations));
+ elgg_save_system_cache('view_types', serialize($CONFIG->view_types));
}
if ($CONFIG->system_cache_enabled && !$CONFIG->i18n_loaded_from_cache) {