aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-04-08 17:16:36 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-04-08 17:16:36 +0000
commit4cfe0887d68f3d89d63e2d7a857fc12186e6fae1 (patch)
tree7763205315543230b23d482848c37d8924cd465a
parentb24464ac9d6bd12b78740197531b582e0fdcd5d4 (diff)
downloadelgg-4cfe0887d68f3d89d63e2d7a857fc12186e6fae1.tar.gz
elgg-4cfe0887d68f3d89d63e2d7a857fc12186e6fae1.tar.bz2
Close #968: View path cache can now be turned on and off
git-svn-id: https://code.elgg.org/elgg/trunk@3197 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--actions/admin/site/update_basic.php5
-rw-r--r--engine/lib/configuration.php6
-rw-r--r--engine/lib/elgglib.php50
-rw-r--r--languages/en.php5
-rw-r--r--views/default/settings/system.php3
5 files changed, 61 insertions, 8 deletions
diff --git a/actions/admin/site/update_basic.php b/actions/admin/site/update_basic.php
index a106a22f0..69481011b 100644
--- a/actions/admin/site/update_basic.php
+++ b/actions/admin/site/update_basic.php
@@ -38,6 +38,11 @@
elgg_view_enable_simplecache();
} else {
elgg_view_disable_simplecache();
+ }
+ if (get_input('viewpath_cache_enabled')) {
+ elgg_enable_filepath_cache();
+ } else {
+ elgg_disable_filepath_cache();
}
set_config('language', get_input('language'), $site->getGUID());
diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php
index fb33d7461..e5c87acb6 100644
--- a/engine/lib/configuration.php
+++ b/engine/lib/configuration.php
@@ -182,6 +182,12 @@
$CONFIG->simplecache_enabled = $simplecache_enabled;
} else {
$CONFIG->simplecache_enabled = 1;
+ }
+ $viewpath_cache_enabled = datalist_get('viewpath_cache_enabled');
+ if ($viewpath_cache_enabled !== false) {
+ $CONFIG->viewpath_cache_enabled = $viewpath_cache_enabled;
+ } else {
+ $CONFIG->viewpath_cache_enabled = 1;
}
if (isset($CONFIG->site) && ($CONFIG->site instanceof ElggSite)) {
$CONFIG->wwwroot = $CONFIG->site->url;
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
diff --git a/languages/en.php b/languages/en.php
index 828e6ce2e..df94470f7 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -792,7 +792,10 @@ Alternatively, you can enter your database settings below and we will try and do
'installation:allow_user_default_access:label' => "Allow user default access",
'installation:simplecache:description' => "The simple cache increases performance by caching static content including some CSS and JavaScript files. Normally you will want this on.",
- 'installation:simplecache:label' => "Use simple cache",
+ 'installation:simplecache:label' => "Use simple cache (recommended)",
+
+ 'installation:viewpathcache:description' => "The view filepath cache increases the loading times of plugins by caching the location of their views.",
+ 'installation:viewpathcache:label' => "Use view filepath cache (recommended)",
'upgrading' => 'Upgrading',
'upgrade:db' => 'Your database was upgraded.',
diff --git a/views/default/settings/system.php b/views/default/settings/system.php
index 420cc225b..fe5e7b245 100644
--- a/views/default/settings/system.php
+++ b/views/default/settings/system.php
@@ -38,7 +38,8 @@
$form_body .= "<p class=\"admin_debug\">" . elgg_echo('admin:site:access:warning') . "<br />";
$form_body .= elgg_echo('installation:sitepermissions') . elgg_view('input/access', array('internalname' => 'default_access','value' => $vars['config']->default_access)) . "</p>";
$form_body .= "<p class=\"admin_debug\">" . elgg_echo('installation:allow_user_default_access:description') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:allow_user_default_access:label')), 'internalname' => 'allow_user_default_access', 'value' => ($vars['config']->allow_user_default_access ? elgg_echo('installation:allow_user_default_access:label') : "") )) . "</p>";
- $form_body .= "<p class=\"admin_debug\">" . elgg_echo('installation:simplecache:description') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:simplecache:label')), 'internalname' => 'simplecache_enabled', 'value' => ($vars['config']->simplecache_enabled ? elgg_echo('installation:simplecache:label') : "") )) . "</p>";
+ $form_body .= "<p class=\"admin_debug\">" . elgg_echo('installation:simplecache:description') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:simplecache:label')), 'internalname' => 'simplecache_enabled', 'value' => ($vars['config']->simplecache_enabled ? elgg_echo('installation:simplecache:label') : "") )) . "</p>";
+ $form_body .= "<p class=\"admin_debug\">" . elgg_echo('installation:viewpathcache:description') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:viewpathcache:label')), 'internalname' => 'viewpath_cache_enabled', 'value' => (($vars['config']->viewpath_cache_enabled) ? elgg_echo('installation:viewpathcache:label') : "") )) . "</p>";
$form_body .= "<p class=\"admin_debug\">" . elgg_echo('installation:debug') . "<br />" .elgg_view("input/checkboxes", array('options' => array(elgg_echo('installation:debug:label')), 'internalname' => 'debug', 'value' => ($vars['config']->debug ? elgg_echo('installation:debug:label') : "") )) . "</p>";