diff options
-rw-r--r-- | actions/admin/plugins/activate.php | 2 | ||||
-rw-r--r-- | actions/admin/plugins/activate_all.php | 2 | ||||
-rw-r--r-- | actions/admin/plugins/deactivate.php | 2 | ||||
-rw-r--r-- | actions/admin/plugins/deactivate_all.php | 2 | ||||
-rw-r--r-- | actions/admin/plugins/set_priority.php | 2 | ||||
-rw-r--r-- | actions/admin/site/flush_cache.php | 2 | ||||
-rw-r--r-- | actions/admin/site/update_advanced.php | 4 | ||||
-rw-r--r-- | engine/lib/cache.php | 80 | ||||
-rw-r--r-- | engine/lib/deprecated-1.8.php | 6 | ||||
-rw-r--r-- | engine/lib/plugins.php | 8 | ||||
-rw-r--r-- | engine/lib/upgrades/2011010101.php | 2 | ||||
-rw-r--r-- | mod/developers/actions/developers/settings.php | 4 | ||||
-rw-r--r-- | 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 |