aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-31 17:13:20 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-31 17:13:20 +0000
commit73fea100984cd8ac1fae690e100df2c6cc930b63 (patch)
treead4dd9fb3db1e51a44ba2792f5f89233e7c702d4
parent9362768fbcdd6eb543bc53e3ad8737eb6297344d (diff)
downloadelgg-73fea100984cd8ac1fae690e100df2c6cc930b63.tar.gz
elgg-73fea100984cd8ac1fae690e100df2c6cc930b63.tar.bz2
Refs #2752, #2635. Merged r7299 to trunk.
git-svn-id: http://code.elgg.org/elgg/trunk@7792 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/cache.php34
-rw-r--r--engine/lib/views.php2
2 files changed, 18 insertions, 18 deletions
diff --git a/engine/lib/cache.php b/engine/lib/cache.php
index 8fe7d3562..72293022a 100644
--- a/engine/lib/cache.php
+++ b/engine/lib/cache.php
@@ -32,49 +32,49 @@ function elgg_get_filepath_cache() {
}
/**
- * Deletes the view file paths cache from disk.
+ * Function which resets the file path cache.
*
- * @return bool On success
*/
function elgg_filepath_cache_reset() {
$cache = elgg_get_filepath_cache();
- return $cache->delete('view_paths');
+ $view_types_result = $cache->delete('view_types');
+ $views_result = $cache->delete('views');
+ return $view_types_result && $views_result;
}
/**
- * Saves $data to the views file paths disk cache as
- * 'view_paths'.
+ * Saves a filepath cache.
*
- * @param mixed $data The data
- *
- * @return bool On success
+ * @param string $type
+ * @param string $data
+ * @return bool
*/
-function elgg_filepath_cache_save($data) {
+function elgg_filepath_cache_save($type, $data) {
global $CONFIG;
if ($CONFIG->viewpath_cache_enabled) {
$cache = elgg_get_filepath_cache();
- return $cache->save('view_paths', $data);
+ return $cache->save($type, $data);
}
return false;
}
/**
- * Returns the contents of the views file paths cache from disk.
+ * Retrieve the contents of the filepath cache.
*
- * @return mixed Null if simplecache isn't enabled, the contents of the
- * views file paths cache if it is.
+ * @param string $type The type of cache to load
+ * @return string
*/
-function elgg_filepath_cache_load() {
+function elgg_filepath_cache_load($type) {
global $CONFIG;
if ($CONFIG->viewpath_cache_enabled) {
$cache = elgg_get_filepath_cache();
- $cached_view_paths = $cache->load('view_paths');
+ $cached_data = $cache->load($type);
- if ($cached_view_paths) {
- return $cached_view_paths;
+ if ($cached_data) {
+ return $cached_data;
}
}
diff --git a/engine/lib/views.php b/engine/lib/views.php
index 942f1b6a7..878db04d8 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -1620,7 +1620,7 @@ function elgg_views_boot() {
elgg_register_event_handler('ready', 'system', 'elgg_views_register_core_head_elements');
// discover the built-in view types
- // @todo cache this
+ // @todo the cache is loaded in load_plugins() but we need to know view_types earlier
$view_path = $CONFIG->viewpath;
$views = scandir($view_path);