aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/admin/plugins/disable.php4
-rw-r--r--actions/admin/plugins/disableall.php4
-rw-r--r--actions/admin/plugins/enable.php4
-rw-r--r--actions/admin/plugins/enableall.php5
-rw-r--r--actions/admin/plugins/reorder.php4
-rw-r--r--engine/lib/elgglib.php52
-rw-r--r--engine/lib/plugins.php12
-rw-r--r--upgrade.php3
8 files changed, 49 insertions, 39 deletions
diff --git a/actions/admin/plugins/disable.php b/actions/admin/plugins/disable.php
index 32ae451a7..f0e07d49b 100644
--- a/actions/admin/plugins/disable.php
+++ b/actions/admin/plugins/disable.php
@@ -33,9 +33,7 @@
}
elgg_view_regenerate_simplecache();
-
- $cache = elgg_get_filepath_cache();
- $cache->delete('view_paths');
+ elgg_filepath_cache_reset();
forward($_SERVER['HTTP_REFERER']);
exit;
diff --git a/actions/admin/plugins/disableall.php b/actions/admin/plugins/disableall.php
index a01b74fa5..00a5713d5 100644
--- a/actions/admin/plugins/disableall.php
+++ b/actions/admin/plugins/disableall.php
@@ -30,9 +30,7 @@
}
elgg_view_regenerate_simplecache();
-
- $cache = elgg_get_filepath_cache();
- $cache->delete('view_paths');
+ elgg_filepath_cache_reset();
forward($_SERVER['HTTP_REFERER']);
exit;
diff --git a/actions/admin/plugins/enable.php b/actions/admin/plugins/enable.php
index d81ab0551..841bc9aae 100644
--- a/actions/admin/plugins/enable.php
+++ b/actions/admin/plugins/enable.php
@@ -33,9 +33,7 @@
}
elgg_view_regenerate_simplecache();
-
- $cache = elgg_get_filepath_cache();
- $cache->delete('view_paths');
+ elgg_filepath_cache_reset();
forward($_SERVER['HTTP_REFERER']);
exit;
diff --git a/actions/admin/plugins/enableall.php b/actions/admin/plugins/enableall.php
index f31b4593d..7789e1e6d 100644
--- a/actions/admin/plugins/enableall.php
+++ b/actions/admin/plugins/enableall.php
@@ -31,10 +31,7 @@
// Regen view cache
elgg_view_regenerate_simplecache();
-
- // Regen paths cache
- $cache = elgg_get_filepath_cache();
- $cache->delete('view_paths');
+ elgg_filepath_cache_reset();
forward($_SERVER['HTTP_REFERER']);
exit;
diff --git a/actions/admin/plugins/reorder.php b/actions/admin/plugins/reorder.php
index 0e328f54d..c42f5fda1 100644
--- a/actions/admin/plugins/reorder.php
+++ b/actions/admin/plugins/reorder.php
@@ -47,9 +47,7 @@
register_error(sprintf(elgg_echo('admin:plugins:reorder:no'), $plugin));
elgg_view_regenerate_simplecache();
-
- $cache = elgg_get_filepath_cache();
- $cache->delete('view_paths');
+ elgg_filepath_cache_reset();
forward($_SERVER['HTTP_REFERER']);
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 524fb548a..872e95c56 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -302,18 +302,6 @@
// Start the output buffer, find the requested view file, and execute it
ob_start();
- // Attempt to cache views [EXPERIMENTAL]
- /*if (ob_get_level()==1) {
- $view_hash = elgg_get_viewhash($view, $vars);
- $view_cache = elgg_get_filepath_cache();
- $cached_view = $view_cache->load($view_hash);
-
- if ($cached_view) {
- ob_get_clean();
- return $cached_view;
- }
- }*/
-
foreach($viewlist as $priority => $view) {
$view_location = elgg_get_view_location($view, $viewtype);
@@ -337,10 +325,6 @@
}
- // Cache view [EXPERIMENTAL]
- //if (ob_get_level()==1) // Only cache top level view
- // $view_cache->save($view_hash, $content);
-
// Save the output buffer into the $content variable
$content = ob_get_clean();
@@ -497,6 +481,42 @@
}
/**
+ * Function which resets the file path cache.
+ *
+ */
+ function elgg_filepath_cache_reset()
+ {
+ $cache = elgg_get_filepath_cache();
+ return $cache->delete('view_paths');
+ }
+
+ /**
+ * Saves a filepath cache.
+ *
+ * @param mixed $data
+ */
+ function elgg_filepath_cache_save($data)
+ {
+ $cache = elgg_get_filepath_cache();
+ return $cache->save('view_paths', $data);
+ }
+
+ /**
+ * Retrieve the contents of the filepath cache.
+ *
+ */
+ function elgg_filepath_cache_load()
+ {
+ $cache = elgg_get_filepath_cache();
+ $cached_view_paths = $cache->load('view_paths');
+
+ if ($cached_view_paths)
+ return $cached_view_paths;
+
+ return NULL;
+ }
+
+ /**
* Internal function for retrieving views used by elgg_view_tree
*
* @param unknown_type $dir
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index 0a373457e..771fe7306 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -192,7 +192,11 @@
$plugins = serialize($plugins);
- $site->pluginorder = $plugins;
+ $site->pluginorder = $plugins;
+
+ // Regenerate caches
+ elgg_view_regenerate_simplecache();
+ elgg_filepath_cache_reset();
return $plugins;
@@ -213,13 +217,11 @@
function load_plugins() {
global $CONFIG;
-
- $cache = elgg_get_filepath_cache();
if (!empty($CONFIG->pluginspath)) {
// See if we have cached values for things
- $cached_view_paths = $cache->load('view_paths');
+ $cached_view_paths = elgg_filepath_cache_load();
if ($cached_view_paths) $CONFIG->views = unserialize($cached_view_paths);
// temporary disable all plugins if there is a file called 'disabled' in the plugin dir
@@ -259,7 +261,7 @@
// Cache results
if (!$cached_view_paths)
- $cache->save('view_paths', serialize($CONFIG->views));
+ elgg_filepath_cache_save(serialize($CONFIG->views));
}
}
diff --git a/upgrade.php b/upgrade.php
index 631ab1c67..ac4cb57ca 100644
--- a/upgrade.php
+++ b/upgrade.php
@@ -24,8 +24,7 @@
}
datalist_set('simplecache_lastupdate',0);
- $cache = elgg_get_filepath_cache();
- $cache->delete('view_paths');
+ elgg_filepath_cache_reset();
} else {
global $CONFIG;
echo elgg_view('settings/upgrading');