aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/elgglib.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/elgglib.php')
-rw-r--r--engine/lib/elgglib.php50
1 files changed, 44 insertions, 6 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 81d2290f6..392f6cd8b 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -431,8 +431,14 @@
*/
function elgg_filepath_cache_save($data)
{
- $cache = elgg_get_filepath_cache();
- return $cache->save('view_paths', $data);
+ global $CONFIG;
+
+ if ($CONFIG->viewpath_cache_enabled) {
+ $cache = elgg_get_filepath_cache();
+ return $cache->save('view_paths', $data);
+ }
+
+ return false;
}
/**
@@ -441,16 +447,48 @@
*/
function elgg_filepath_cache_load()
{
- $cache = elgg_get_filepath_cache();
- $cached_view_paths = $cache->load('view_paths');
+ global $CONFIG;
- if ($cached_view_paths)
- return $cached_view_paths;
+ if ($CONFIG->viewpath_cache_enabled) {
+ $cache = elgg_get_filepath_cache();
+ $cached_view_paths = $cache->load('view_paths');
+
+ if ($cached_view_paths)
+ return $cached_view_paths;
+ }
return NULL;
}
/**
+ * Enable the filepath cache.
+ *
+ */
+ function elgg_enable_filepath_cache()
+ {
+ global $CONFIG;
+
+ datalist_set('viewpath_cache_enabled',1);
+ $CONFIG->viewpath_cache_enabled = 1;
+ elgg_filepath_cache_reset();
+
+ }
+
+ /**
+ * Disable filepath cache.
+ *
+ */
+ function elgg_disable_filepath_cache()
+ {
+ global $CONFIG;
+
+ datalist_set('viewpath_cache_enabled',0);
+ $CONFIG->viewpath_cache_enabled = 0;
+ elgg_filepath_cache_reset();
+
+ }
+
+ /**
* Internal function for retrieving views used by elgg_view_tree
*
* @param unknown_type $dir