$cache = elgg_get_system_cache();
$result = true;
- $cache_types = array('view_paths', 'view_types');
+ $cache_types = array('view_locations', 'view_types');
foreach ($cache_types as $type) {
$result = $result && $cache->delete($type);
}
*/
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;
}
/**
// 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));
}
}