From 52b6fde352fd0282a8a3ddfc3f2ff218d97f7dbb Mon Sep 17 00:00:00 2001 From: marcus Date: Tue, 3 Mar 2009 11:18:09 +0000 Subject: Closes #831: Plugin view location is now cached in a file in dataroot and is invalidated on upgrade and plugin enable/disable/reorder. This means that views no longer have to be discovered on boot - reducing file IO from crazy amounts to 1. This also helps make adding new plugins a linear event. git-svn-id: https://code.elgg.org/elgg/trunk@3025 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'engine/lib/elgglib.php') diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 1b2629a22..5571339cd 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -495,6 +495,21 @@ } } + /** + * This is a factory function which produces an ElggCache object suitable for caching file load paths. + * + * TODO: Can this be done in a cleaner way? + * TODO: Swap to memcache etc? + */ + function elgg_get_filepath_cache() + { + global $CONFIG; + static $FILE_PATH_CACHE; + if (!$FILE_PATH_CACHE) $FILE_PATH_CACHE = new ElggFileCache($CONFIG->dataroot); + + return $FILE_PATH_CACHE; + } + /** * Internal function for retrieving views used by elgg_view_tree * -- cgit v1.2.3