aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/plugins.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/plugins.php')
-rw-r--r--engine/lib/plugins.php49
1 files changed, 35 insertions, 14 deletions
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index 937766e66..c70cd8ebc 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -210,10 +210,21 @@
* @package Elgg
* @subpackage Core
*/
- function load_plugins() {
-
- global $CONFIG;
- if (!empty($CONFIG->pluginspath)) {
+ function load_plugins() {
+
+ global $CONFIG;
+
+ $cache = elgg_get_filepath_cache();
+
+ if (!empty($CONFIG->pluginspath)) {
+
+ // See if we have cached values for things
+ $cached_view_paths = $cache->load('view_paths');
+ if ($cached_view_paths) $CONFIG->views = unserialize($cached_view_paths);
+
+ $cached_lang_paths = $cache->load('lang_paths');
+ if ($cached_lang_paths) $CONFIG->views = unserialize($cached_lang_paths);
+
// temporary disable all plugins if there is a file called 'disabled' in the plugin dir
if (file_exists($CONFIG->pluginspath . "disabled"))
@@ -221,28 +232,38 @@
$plugins = get_plugin_list();
- if (sizeof($plugins))
+ if (sizeof($plugins))
+ {
foreach($plugins as $mod) {
if (is_plugin_enabled($mod)) {
if (file_exists($CONFIG->pluginspath . $mod)) {
if (!include($CONFIG->pluginspath . $mod . "/start.php"))
- throw new PluginException(sprintf(elgg_echo('PluginException:MisconfiguredPlugin'), $mod));
- if (is_dir($CONFIG->pluginspath . $mod . "/views")) {
- if ($handle = opendir($CONFIG->pluginspath . $mod . "/views")) {
- while ($viewtype = readdir($handle)) {
- if (!in_array($viewtype,array('.','..','.svn','CVS')) && is_dir($CONFIG->pluginspath . $mod . "/views/" . $viewtype)) {
- autoregister_views("",$CONFIG->pluginspath . $mod . "/views/" . $viewtype,$CONFIG->pluginspath . $mod . "/views/", $viewtype);
+ throw new PluginException(sprintf(elgg_echo('PluginException:MisconfiguredPlugin'), $mod));
+
+ if (!$cached_view_paths)
+ {
+ if (is_dir($CONFIG->pluginspath . $mod . "/views")) {
+ if ($handle = opendir($CONFIG->pluginspath . $mod . "/views")) {
+ while ($viewtype = readdir($handle)) {
+ if (!in_array($viewtype,array('.','..','.svn','CVS')) && is_dir($CONFIG->pluginspath . $mod . "/views/" . $viewtype)) {
+ autoregister_views("",$CONFIG->pluginspath . $mod . "/views/" . $viewtype,$CONFIG->pluginspath . $mod . "/views/", $viewtype);
+ }
}
}
- }
- }
+ }
+ }
+
if (is_dir($CONFIG->pluginspath . $mod . "/languages")) {
register_translations($CONFIG->pluginspath . $mod . "/languages/");
}
}
}
}
-
+ }
+
+ // Cache results
+ if (!$cached_view_paths)
+ $cache->save('view_paths', serialize($CONFIG->views));
}
}