diff options
Diffstat (limited to 'engine')
-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 |
4 files changed, 67 insertions, 29 deletions
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'); |