From 3874c13a404dafd526d7e34ca660239dc34dd300 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Jan 2012 12:16:53 -0500 Subject: switched the function names to system cache --- actions/admin/plugins/activate.php | 2 +- actions/admin/plugins/activate_all.php | 2 +- actions/admin/plugins/deactivate.php | 2 +- actions/admin/plugins/deactivate_all.php | 2 +- actions/admin/plugins/set_priority.php | 2 +- actions/admin/site/flush_cache.php | 2 +- actions/admin/site/update_advanced.php | 4 +- engine/lib/cache.php | 80 +++++++++++++++++++------- engine/lib/deprecated-1.8.php | 6 +- engine/lib/plugins.php | 8 +-- engine/lib/upgrades/2011010101.php | 2 +- mod/developers/actions/developers/settings.php | 4 +- upgrade.php | 2 +- 13 files changed, 78 insertions(+), 40 deletions(-) diff --git a/actions/admin/plugins/activate.php b/actions/admin/plugins/activate.php index 224b5a2ae..286cf5a4f 100644 --- a/actions/admin/plugins/activate.php +++ b/actions/admin/plugins/activate.php @@ -38,7 +38,7 @@ foreach ($plugin_guids as $guid) { // don't regenerate the simplecache because the plugin won't be // loaded until next run. Just invalidate and let it regenerate as needed elgg_invalidate_simplecache(); -elgg_filepath_cache_reset(); +elgg_reset_system_cache(); if (count($activated_guids) === 1) { $url = 'admin/plugins'; diff --git a/actions/admin/plugins/activate_all.php b/actions/admin/plugins/activate_all.php index 19c142346..4514ccbdf 100644 --- a/actions/admin/plugins/activate_all.php +++ b/actions/admin/plugins/activate_all.php @@ -28,6 +28,6 @@ foreach ($guids as $guid) { // don't regenerate the simplecache because the plugin won't be // loaded until next run. Just invalidate and let it regnerate as needed elgg_invalidate_simplecache(); -elgg_filepath_cache_reset(); +elgg_reset_system_cache(); forward(REFERER); \ No newline at end of file diff --git a/actions/admin/plugins/deactivate.php b/actions/admin/plugins/deactivate.php index 2ce796eff..e7ce65625 100644 --- a/actions/admin/plugins/deactivate.php +++ b/actions/admin/plugins/deactivate.php @@ -37,7 +37,7 @@ foreach ($plugin_guids as $guid) { // don't regenerate the simplecache because the plugin won't be // loaded until next run. Just invalidate and let it regnerate as needed elgg_invalidate_simplecache(); -elgg_filepath_cache_reset(); +elgg_reset_system_cache(); if (count($plugin_guids) == 1) { $url = 'admin/plugins'; diff --git a/actions/admin/plugins/deactivate_all.php b/actions/admin/plugins/deactivate_all.php index 479e9c607..8b347a633 100644 --- a/actions/admin/plugins/deactivate_all.php +++ b/actions/admin/plugins/deactivate_all.php @@ -28,6 +28,6 @@ foreach ($guids as $guid) { // don't regenerate the simplecache because the plugin won't be // loaded until next run. Just invalidate and let it regnerate as needed elgg_invalidate_simplecache(); -elgg_filepath_cache_reset(); +elgg_reset_system_cache(); forward(REFERER); diff --git a/actions/admin/plugins/set_priority.php b/actions/admin/plugins/set_priority.php index 79b1c4c53..edd735371 100644 --- a/actions/admin/plugins/set_priority.php +++ b/actions/admin/plugins/set_priority.php @@ -34,6 +34,6 @@ if ($plugin->setPriority($priority)) { // don't regenerate the simplecache because the plugin won't be // loaded until next run. Just invalidate and let it regnerate as needed elgg_invalidate_simplecache(); -elgg_filepath_cache_reset(); +elgg_reset_system_cache(); forward(REFERER); \ No newline at end of file diff --git a/actions/admin/site/flush_cache.php b/actions/admin/site/flush_cache.php index b81f5fc83..ebb8296c7 100644 --- a/actions/admin/site/flush_cache.php +++ b/actions/admin/site/flush_cache.php @@ -4,7 +4,7 @@ */ elgg_invalidate_simplecache(); -elgg_filepath_cache_reset(); +elgg_reset_system_cache(); system_message(elgg_echo('admin:cache:flushed')); forward(REFERER); \ No newline at end of file diff --git a/actions/admin/site/update_advanced.php b/actions/admin/site/update_advanced.php index 12c5542e7..d4796ea7d 100644 --- a/actions/admin/site/update_advanced.php +++ b/actions/admin/site/update_advanced.php @@ -26,9 +26,9 @@ if ($site = elgg_get_site_entity()) { } if (get_input('viewpath_cache_enabled')) { - elgg_enable_filepath_cache(); + elgg_enable_system_cache(); } else { - elgg_disable_filepath_cache(); + elgg_disable_system_cache(); } set_config('default_access', get_input('default_access', ACCESS_PRIVATE), $site->getGUID()); diff --git a/engine/lib/cache.php b/engine/lib/cache.php index 47c3af73c..b563f5ab0 100644 --- a/engine/lib/cache.php +++ b/engine/lib/cache.php @@ -10,15 +10,14 @@ /* Filepath Cache */ /** - * Returns an ElggCache object suitable for caching view - * file load paths to disk under $CONFIG->dataroot. + * Returns an ElggCache object suitable for caching system information * * @todo Can this be done in a cleaner way? * @todo Swap to memcache etc? * - * @return ElggFileCache A cache object suitable for caching file load paths. + * @return ElggFileCache */ -function elgg_get_filepath_cache() { +function elgg_get_system_cache() { global $CONFIG; /** @@ -34,29 +33,29 @@ function elgg_get_filepath_cache() { } /** - * Reset the file path cache. + * Reset the system cache by deleting the caches * * @return bool */ -function elgg_filepath_cache_reset() { - $cache = elgg_get_filepath_cache(); +function elgg_reset_system_cache() { + $cache = elgg_get_system_cache(); $view_types_result = $cache->delete('view_types'); $views_result = $cache->delete('views'); return $view_types_result && $views_result; } /** - * Saves a filepath cache. + * Saves a system cache. * * @param string $type The type or identifier of the cache * @param string $data The data to be saved * @return bool */ -function elgg_filepath_cache_save($type, $data) { +function elgg_save_system_cache($type, $data) { global $CONFIG; if ($CONFIG->viewpath_cache_enabled) { - $cache = elgg_get_filepath_cache(); + $cache = elgg_get_system_cache(); return $cache->save($type, $data); } @@ -64,16 +63,16 @@ function elgg_filepath_cache_save($type, $data) { } /** - * Retrieve the contents of the filepath cache. + * Retrieve the contents of a system cache. * * @param string $type The type of cache to load * @return string */ -function elgg_filepath_cache_load($type) { +function elgg_load_system_cache($type) { global $CONFIG; if ($CONFIG->viewpath_cache_enabled) { - $cache = elgg_get_filepath_cache(); + $cache = elgg_get_system_cache(); $cached_data = $cache->load($type); if ($cached_data) { @@ -85,35 +84,74 @@ function elgg_filepath_cache_load($type) { } /** - * Enables the views file paths disk cache. + * Enables the system disk cache. * * Uses the 'viewpath_cache_enabled' datalist with a boolean value. - * Resets the views paths cache. + * Resets the system cache. * * @return void */ -function elgg_enable_filepath_cache() { +function elgg_enable_system_cache() { global $CONFIG; datalist_set('viewpath_cache_enabled', 1); $CONFIG->viewpath_cache_enabled = 1; - elgg_filepath_cache_reset(); + elgg_reset_system_cache(); } /** - * Disables the views file paths disk cache. + * Disables the system disk cache. * * Uses the 'viewpath_cache_enabled' datalist with a boolean value. - * Resets the views paths cache. + * Resets the system cache. * * @return void */ -function elgg_disable_filepath_cache() { +function elgg_disable_system_cache() { global $CONFIG; datalist_set('viewpath_cache_enabled', 0); $CONFIG->viewpath_cache_enabled = 0; - elgg_filepath_cache_reset(); + elgg_reset_system_cache(); +} + +/** @todo deprecate in Elgg 1.9 **/ + +/** + * @access private + */ +function elgg_get_filepath_cache() { + return elgg_get_system_cache(); +} +/** + * @access private + */ +function elgg_filepath_cache_reset() { + return elgg_reset_system_cache(); +} +/** + * @access private + */ +function elgg_filepath_cache_save($type, $data) { + return elgg_save_system_cache($type, $data); +} +/** + * @access private + */ +function elgg_filepath_cache_load($type) { + return elgg_load_system_cache($type); +} +/** + * @access private + */ +function elgg_enable_filepath_cache() { + return elgg_enable_system_cache(); +} +/** + * @access private + */ +function elgg_disable_filepath_cache() { + return elgg_disable_system_cache(); } /* Simplecache */ diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php index e1866498b..4b9d41543 100644 --- a/engine/lib/deprecated-1.8.php +++ b/engine/lib/deprecated-1.8.php @@ -1674,7 +1674,7 @@ function get_plugin_list() { * otherwise you may experience view display artifacts. Do this with the following code: * * elgg_regenerate_simplecache(); - * elgg_filepath_cache_reset(); + * elgg_reset_system_cache(); * * @deprecated 1.8 Use elgg_generate_plugin_entities() and elgg_set_plugin_priorities() * @@ -1841,7 +1841,7 @@ function get_installed_plugins($status = 'all') { * otherwise you may experience view display artifacts. Do this with the following code: * * elgg_regenerate_simplecache(); - * elgg_filepath_cache_reset(); + * elgg_reset_system_cache(); * * @deprecated 1.8 Use ElggPlugin->activate() * @@ -1882,7 +1882,7 @@ function enable_plugin($plugin, $site_guid = null) { * otherwise you may experience view display artifacts. Do this with the following code: * * elgg_regenerate_simplecache(); - * elgg_filepath_cache_reset(); + * elgg_reset_system_cache(); * * @deprecated 1.8 Use ElggPlugin->deactivate() * diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 7968f4a6e..bbec52c2e 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -302,8 +302,8 @@ function elgg_load_plugins() { } // Load view caches if available - $cached_view_paths = elgg_filepath_cache_load('views'); - $cached_view_types = elgg_filepath_cache_load('view_types'); + $cached_view_paths = elgg_load_system_cache('views'); + $cached_view_types = elgg_load_system_cache('view_types'); $cached_view_info = is_string($cached_view_paths) && is_string($cached_view_types); if ($cached_view_info) { @@ -334,8 +334,8 @@ function elgg_load_plugins() { // Cache results if (!$cached_view_info) { - elgg_filepath_cache_save('views', serialize($CONFIG->views)); - elgg_filepath_cache_save('view_types', serialize($CONFIG->view_types)); + elgg_save_system_cache('views', serialize($CONFIG->views)); + elgg_save_system_cache('view_types', serialize($CONFIG->view_types)); } return $return; diff --git a/engine/lib/upgrades/2011010101.php b/engine/lib/upgrades/2011010101.php index b063c249b..a1ee92622 100644 --- a/engine/lib/upgrades/2011010101.php +++ b/engine/lib/upgrades/2011010101.php @@ -66,7 +66,7 @@ if ($old_enabled_plugins) { // invalidate caches elgg_invalidate_simplecache(); -elgg_filepath_cache_reset(); +elgg_reset_system_cache(); // clean up. remove_metadata($site->guid, 'pluginorder'); diff --git a/mod/developers/actions/developers/settings.php b/mod/developers/actions/developers/settings.php index 811fd22c0..6249821a2 100644 --- a/mod/developers/actions/developers/settings.php +++ b/mod/developers/actions/developers/settings.php @@ -12,9 +12,9 @@ if (get_input('simple_cache')) { } if (get_input('view_path_cache')) { - elgg_enable_filepath_cache(); + elgg_enable_system_cache(); } else { - elgg_disable_filepath_cache(); + elgg_disable_system_cache(); } $debug = get_input('debug_level'); diff --git a/upgrade.php b/upgrade.php index ab769f542..3081f7a77 100644 --- a/upgrade.php +++ b/upgrade.php @@ -25,7 +25,7 @@ if (get_input('upgrade') == 'upgrade') { } elgg_trigger_event('upgrade', 'system', null); elgg_invalidate_simplecache(); - elgg_filepath_cache_reset(); + elgg_reset_system_cache(); } else { // if upgrading from < 1.8.0, check for the core view 'welcome' and bail if it's found. // see http://trac.elgg.org/ticket/3064 -- cgit v1.2.3 From 8e4d4c50df3f19be4ad9c204797e57ecd9ba02b3 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Jan 2012 12:31:25 -0500 Subject: updated the display to show system cache language --- actions/admin/site/update_advanced.php | 2 +- languages/en.php | 4 ++-- mod/developers/actions/developers/settings.php | 2 +- mod/developers/languages/en.php | 6 +++--- mod/developers/views/default/admin/developers/settings.php | 2 +- views/default/forms/admin/site/update_advanced.php | 8 ++++---- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/actions/admin/site/update_advanced.php b/actions/admin/site/update_advanced.php index d4796ea7d..23d622a62 100644 --- a/actions/admin/site/update_advanced.php +++ b/actions/admin/site/update_advanced.php @@ -25,7 +25,7 @@ if ($site = elgg_get_site_entity()) { elgg_disable_simplecache(); } - if (get_input('viewpath_cache_enabled')) { + if (get_input('system_cache_enabled')) { elgg_enable_system_cache(); } else { elgg_disable_system_cache(); diff --git a/languages/en.php b/languages/en.php index 97867f922..76ef07b4d 100644 --- a/languages/en.php +++ b/languages/en.php @@ -1032,8 +1032,8 @@ Once you have logged in, we highly recommend that you change your password. '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 (recommended)", - 'installation:viewpathcache:description' => "The view filepath cache decreases the loading times of plugins by caching the location of their views.", - 'installation:viewpathcache:label' => "Use view filepath cache (recommended)", + 'installation:systemcache:description' => "The system cache decreases the loading time of the Elgg engine by caching data to files.", + 'installation:systemcache:label' => "Use system cache (recommended)", 'upgrading' => 'Upgrading...', 'upgrade:db' => 'Your database was upgraded.', diff --git a/mod/developers/actions/developers/settings.php b/mod/developers/actions/developers/settings.php index 6249821a2..7c91e2f5f 100644 --- a/mod/developers/actions/developers/settings.php +++ b/mod/developers/actions/developers/settings.php @@ -11,7 +11,7 @@ if (get_input('simple_cache')) { elgg_disable_simplecache(); } -if (get_input('view_path_cache')) { +if (get_input('system_cache')) { elgg_enable_system_cache(); } else { elgg_disable_system_cache(); diff --git a/mod/developers/languages/en.php b/mod/developers/languages/en.php index 812f779fa..262759e23 100644 --- a/mod/developers/languages/en.php +++ b/mod/developers/languages/en.php @@ -16,9 +16,9 @@ $english = array( // settings 'elgg_dev_tools:settings:explanation' => 'Control your development and debugging settings below. Some of these settings are also available on other admin pages.', 'developers:label:simple_cache' => 'Use simple cache', - 'developers:help:simple_cache' => 'Turn off the file cache when developing. Otherwise, changes to your views (including css) will be ignored.', - 'developers:label:view_path_cache' => 'Use view path cache', - 'developers:help:view_path_cache' => 'Turn this off when developing. Otherwise, new views in your plugins will not be registered.', + 'developers:help:simple_cache' => 'Turn off this cache when developing. Otherwise, changes to your CSS and JavaScript will be ignored.', + 'developers:label:system_cache' => 'Use system cache', + 'developers:help:system_cache' => 'Turn this off when developing. Otherwise, changes in your plugins will not be registered.', 'developers:label:debug_level' => "Trace level", 'developers:help:debug_level' => "This controls the amount of information logged. See elgg_log() for more information.", 'developers:label:display_errors' => 'Display fatal PHP errors', diff --git a/mod/developers/views/default/admin/developers/settings.php b/mod/developers/views/default/admin/developers/settings.php index dcc0a3e4f..519364fe1 100644 --- a/mod/developers/views/default/admin/developers/settings.php +++ b/mod/developers/views/default/admin/developers/settings.php @@ -10,7 +10,7 @@ $data = array( 'checked' => elgg_get_config('simplecache_enabled') == 1, ), - 'view_path_cache' => array( + 'system_cache' => array( 'type' => 'checkbox', 'value' => 1, 'checked' => elgg_get_config('viewpath_cache_enabled') == 1, diff --git a/views/default/forms/admin/site/update_advanced.php b/views/default/forms/admin/site/update_advanced.php index f79a235b5..786feb101 100644 --- a/views/default/forms/admin/site/update_advanced.php +++ b/views/default/forms/admin/site/update_advanced.php @@ -40,11 +40,11 @@ $form_body .= elgg_view("input/checkboxes", array( 'name' => 'simplecache_enabled', 'value' => (elgg_get_config('simplecache_enabled') ? elgg_echo('installation:simplecache:label') : ""), )) . ""; -$form_body .= "
" . elgg_echo('installation:viewpathcache:description') . "
"; +$form_body .= "
" . elgg_echo('installation:systemcache:description') . "
"; $form_body .= elgg_view("input/checkboxes", array( - 'options' => array(elgg_echo('installation:viewpathcache:label') => elgg_echo('installation:viewpathcache:label')), - 'name' => 'viewpath_cache_enabled', - 'value' => (elgg_get_config('viewpath_cache_enabled') ? elgg_echo('installation:viewpathcache:label') : ""), + 'options' => array(elgg_echo('installation:systemcache:label') => elgg_echo('installation:systemcache:label')), + 'name' => 'system_cache_enabled', + 'value' => (elgg_get_config('viewpath_cache_enabled') ? elgg_echo('installation:systemcache:label') : ""), )) . "
"; $debug_options = array('0' => elgg_echo('installation:debug:none'), 'ERROR' => elgg_echo('installation:debug:error'), 'WARNING' => elgg_echo('installation:debug:warning'), 'NOTICE' => elgg_echo('installation:debug:notice')); -- cgit v1.2.3 From 19a6962c819dc33a0967dcef56154f6930b52287 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Jan 2012 12:44:55 -0500 Subject: Fixes #4180 finished conversion to system cache by converting datalist/CONFIG var name --- documentation/info/config.php | 6 +++--- engine/lib/cache.php | 16 ++++++++-------- engine/lib/configuration.php | 8 ++++---- .../2012012100-1.8.3-system_cache-93100e7d55a24a11.php | 13 +++++++++++++ install/ElggInstaller.php | 2 +- .../views/default/admin/developers/settings.php | 2 +- version.php | 2 +- views/default/forms/admin/site/update_advanced.php | 2 +- 8 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 engine/lib/upgrades/2012012100-1.8.3-system_cache-93100e7d55a24a11.php diff --git a/documentation/info/config.php b/documentation/info/config.php index 19e76c8ae..b45428477 100644 --- a/documentation/info/config.php +++ b/documentation/info/config.php @@ -218,11 +218,11 @@ $CONFIG->dataroot; $CONFIG->simplecache_enabled; /** - * Is view paths cache enabled + * Is the system cache enabled * - * @global string $CONFIG->viewpath_cache_enabled + * @global string $CONFIG->system_cache_enabled */ -$CONFIG->viewpath_cache_enabled; +$CONFIG->system_cache_enabled; /** * The site description from the current site object. diff --git a/engine/lib/cache.php b/engine/lib/cache.php index b563f5ab0..75183d23a 100644 --- a/engine/lib/cache.php +++ b/engine/lib/cache.php @@ -54,7 +54,7 @@ function elgg_reset_system_cache() { function elgg_save_system_cache($type, $data) { global $CONFIG; - if ($CONFIG->viewpath_cache_enabled) { + if ($CONFIG->system_cache_enabled) { $cache = elgg_get_system_cache(); return $cache->save($type, $data); } @@ -71,7 +71,7 @@ function elgg_save_system_cache($type, $data) { function elgg_load_system_cache($type) { global $CONFIG; - if ($CONFIG->viewpath_cache_enabled) { + if ($CONFIG->system_cache_enabled) { $cache = elgg_get_system_cache(); $cached_data = $cache->load($type); @@ -86,7 +86,7 @@ function elgg_load_system_cache($type) { /** * Enables the system disk cache. * - * Uses the 'viewpath_cache_enabled' datalist with a boolean value. + * Uses the 'system_cache_enabled' datalist with a boolean value. * Resets the system cache. * * @return void @@ -94,15 +94,15 @@ function elgg_load_system_cache($type) { function elgg_enable_system_cache() { global $CONFIG; - datalist_set('viewpath_cache_enabled', 1); - $CONFIG->viewpath_cache_enabled = 1; + datalist_set('system_cache_enabled', 1); + $CONFIG->system_cache_enabled = 1; elgg_reset_system_cache(); } /** * Disables the system disk cache. * - * Uses the 'viewpath_cache_enabled' datalist with a boolean value. + * Uses the 'system_cache_enabled' datalist with a boolean value. * Resets the system cache. * * @return void @@ -110,8 +110,8 @@ function elgg_enable_system_cache() { function elgg_disable_system_cache() { global $CONFIG; - datalist_set('viewpath_cache_enabled', 0); - $CONFIG->viewpath_cache_enabled = 0; + datalist_set('system_cache_enabled', 0); + $CONFIG->system_cache_enabled = 0; elgg_reset_system_cache(); } diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php index cccd69105..772c24930 100644 --- a/engine/lib/configuration.php +++ b/engine/lib/configuration.php @@ -599,11 +599,11 @@ function _elgg_load_application_config() { } 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; + $system_cache_enabled = datalist_get('system_cache_enabled'); + if ($system_cache_enabled !== false) { + $CONFIG->system_cache_enabled = $system_cache_enabled; } else { - $CONFIG->viewpath_cache_enabled = 1; + $CONFIG->system_cache_enabled = 1; } // initialize context here so it is set before the get_input call diff --git a/engine/lib/upgrades/2012012100-1.8.3-system_cache-93100e7d55a24a11.php b/engine/lib/upgrades/2012012100-1.8.3-system_cache-93100e7d55a24a11.php new file mode 100644 index 000000000..3a9aae2a1 --- /dev/null +++ b/engine/lib/upgrades/2012012100-1.8.3-system_cache-93100e7d55a24a11.php @@ -0,0 +1,13 @@ +dbprefix}datalists WHERE name='viewpath_cache_enabled'"; +delete_data($query); diff --git a/install/ElggInstaller.php b/install/ElggInstaller.php index d556ba744..0e75ed008 100644 --- a/install/ElggInstaller.php +++ b/install/ElggInstaller.php @@ -1401,7 +1401,7 @@ class ElggInstaller { datalist_set('default_site', $site->getGUID()); datalist_set('version', get_version()); datalist_set('simplecache_enabled', 1); - datalist_set('viewpath_cache_enabled', 1); + datalist_set('system_cache_enabled', 1); // new installations have run all the upgrades $upgrades = elgg_get_upgrade_files($submissionVars['path'] . 'engine/lib/upgrades/'); diff --git a/mod/developers/views/default/admin/developers/settings.php b/mod/developers/views/default/admin/developers/settings.php index 519364fe1..459cbabad 100644 --- a/mod/developers/views/default/admin/developers/settings.php +++ b/mod/developers/views/default/admin/developers/settings.php @@ -13,7 +13,7 @@ $data = array( 'system_cache' => array( 'type' => 'checkbox', 'value' => 1, - 'checked' => elgg_get_config('viewpath_cache_enabled') == 1, + 'checked' => elgg_get_config('system_cache_enabled') == 1, ), 'display_errors' => array( diff --git a/version.php b/version.php index 540fecac6..dc6897c18 100644 --- a/version.php +++ b/version.php @@ -11,7 +11,7 @@ // YYYYMMDD = Elgg Date // XX = Interim incrementer -$version = 2012012000; +$version = 2012012100; // Human-friendly version name $release = '1.8.3'; diff --git a/views/default/forms/admin/site/update_advanced.php b/views/default/forms/admin/site/update_advanced.php index 786feb101..b935090f0 100644 --- a/views/default/forms/admin/site/update_advanced.php +++ b/views/default/forms/admin/site/update_advanced.php @@ -44,7 +44,7 @@ $form_body .= "
" . elgg_echo('installation:systemcache:description') . "
array(elgg_echo('installation:systemcache:label') => elgg_echo('installation:systemcache:label')), 'name' => 'system_cache_enabled', - 'value' => (elgg_get_config('viewpath_cache_enabled') ? elgg_echo('installation:systemcache:label') : ""), + 'value' => (elgg_get_config('system_cache_enabled') ? elgg_echo('installation:systemcache:label') : ""), )) . "
"; $debug_options = array('0' => elgg_echo('installation:debug:none'), 'ERROR' => elgg_echo('installation:debug:error'), 'WARNING' => elgg_echo('installation:debug:warning'), 'NOTICE' => elgg_echo('installation:debug:notice')); -- cgit v1.2.3 From b466d3e188a001f8d7ede1afbf3927c6dbdeae15 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Jan 2012 13:03:47 -0500 Subject: better location for system cache in data directory --- engine/lib/cache.php | 12 ++++++++---- engine/lib/plugins.php | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/engine/lib/cache.php b/engine/lib/cache.php index 75183d23a..cfda26e52 100644 --- a/engine/lib/cache.php +++ b/engine/lib/cache.php @@ -26,7 +26,7 @@ function elgg_get_system_cache() { static $FILE_PATH_CACHE; if (!$FILE_PATH_CACHE) { - $FILE_PATH_CACHE = new ElggFileCache($CONFIG->dataroot); + $FILE_PATH_CACHE = new ElggFileCache($CONFIG->dataroot . 'system_cache/'); } return $FILE_PATH_CACHE; @@ -39,9 +39,13 @@ function elgg_get_system_cache() { */ function elgg_reset_system_cache() { $cache = elgg_get_system_cache(); - $view_types_result = $cache->delete('view_types'); - $views_result = $cache->delete('views'); - return $view_types_result && $views_result; + + $result = true; + $cache_types = array('view_paths', 'view_types'); + foreach ($cache_types as $type) { + $result = $result && $cache->delete($type); + } + return $result; } /** diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index bbec52c2e..d9c7b321b 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -302,7 +302,7 @@ function elgg_load_plugins() { } // Load view caches if available - $cached_view_paths = elgg_load_system_cache('views'); + $cached_view_paths = elgg_load_system_cache('view_paths'); $cached_view_types = elgg_load_system_cache('view_types'); $cached_view_info = is_string($cached_view_paths) && is_string($cached_view_types); @@ -334,7 +334,7 @@ function elgg_load_plugins() { // Cache results if (!$cached_view_info) { - elgg_save_system_cache('views', serialize($CONFIG->views)); + elgg_save_system_cache('view_paths', serialize($CONFIG->views)); elgg_save_system_cache('view_types', serialize($CONFIG->view_types)); } -- cgit v1.2.3 From 7c962fa6cbaf687daafb8588ff601fe664e1392c Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 21 Jan 2012 13:33:40 -0500 Subject: moved cache loading out of plugin code --- engine/lib/cache.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- engine/lib/elgglib.php | 2 ++ engine/lib/plugins.php | 17 +---------------- 3 files changed, 50 insertions(+), 18 deletions(-) diff --git a/engine/lib/cache.php b/engine/lib/cache.php index cfda26e52..633c470eb 100644 --- a/engine/lib/cache.php +++ b/engine/lib/cache.php @@ -395,7 +395,40 @@ function elgg_invalidate_simplecache() { return $return; } -function elgg_cache_init() { +/** + * @see elgg_reset_system_cache() + * @access private + */ +function _elgg_load_cache() { + global $CONFIG; + + $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]); + } + + if ($result) { + $CONFIG->system_cache_loaded = true; + foreach ($data as $name => $value) { + $CONFIG->$name = unserialize($value); + } + } else { + $CONFIG->system_cache_loaded = false; + } +} + +/** + * @access private + */ +function _elgg_cache_init() { + global $CONFIG; + $viewtype = elgg_get_viewtype(); // Regenerate the simple cache if expired. @@ -410,6 +443,18 @@ function elgg_cache_init() { } $CONFIG->lastcache = $lastcached; } + + // 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_register_event_handler('ready', 'system', 'elgg_cache_init'); \ No newline at end of file +elgg_register_event_handler('ready', 'system', '_elgg_cache_init'); diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 98e7af2a9..3c56567e9 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -2080,6 +2080,8 @@ function _elgg_engine_boot() { _elgg_load_application_config(); _elgg_load_site_config(); + + _elgg_load_cache(); } /** diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index d9c7b321b..07b21d276 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -301,16 +301,7 @@ function elgg_load_plugins() { return false; } - // Load view caches if available - $cached_view_paths = elgg_load_system_cache('view_paths'); - $cached_view_types = elgg_load_system_cache('view_types'); - $cached_view_info = is_string($cached_view_paths) && is_string($cached_view_types); - - if ($cached_view_info) { - $CONFIG->views = unserialize($cached_view_paths); - $CONFIG->view_types = unserialize($cached_view_types); - - // don't need to register views + if (elgg_get_config('system_cache_loaded')) { $start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_VIEWS; } @@ -332,12 +323,6 @@ function elgg_load_plugins() { } } - // Cache results - if (!$cached_view_info) { - elgg_save_system_cache('view_paths', serialize($CONFIG->views)); - elgg_save_system_cache('view_types', serialize($CONFIG->view_types)); - } - return $return; } -- cgit v1.2.3