From 82593cd2bc056da73caa1b1e981c5a9ead0f1bf2 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 27 Apr 2011 02:37:16 +0000 Subject: Refs #3362. Plugins don't check deps upon boot. Made package and manifest private properties of ElggPlugin and added ->getPackage() and ->getManifest(). git-svn-id: http://code.elgg.org/elgg/trunk@9030 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/plugins.php | 39 +++++++-------------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) (limited to 'engine/lib/plugins.php') diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 0947b7a8e..5aed3065a 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -266,9 +266,9 @@ function elgg_is_active_plugin($plugin_id, $site_guid = null) { /** * Loads all active plugins in the order specified in the tool admin panel. * - * @note This is called on every page load and includes additional checking that plugins - * are fit to be loaded. If a plugin is active and problematic, it will be disabled - * and a visible error emitted. + * @note This is called on every page load. If a plugin is active and problematic, it + * will be disabled and a visible error emitted. This does not check the deps system because + * that was too slow. * * @return bool */ @@ -307,17 +307,6 @@ function elgg_load_plugins() { $plugins = elgg_get_plugins('active'); if ($plugins) { foreach ($plugins as $plugin) { - // check if plugin can be started and try to start it. - // if anything is bad, disable it and emit a message. - if (!$plugin->isValid()) { - $plugin->deactivate(); - $msg = elgg_echo('PluginException:MisconfiguredPlugin', array($plugin->getID(), $plugin->guid)); - register_error($msg); - $return = false; - - continue; - } - try { $plugin->start($start_flags); } catch (Exception $e) { @@ -345,11 +334,10 @@ function elgg_load_plugins() { * Returns an ordered list of plugins * * @param string $status The status of the plugins. active, inactive, or all. - * @param bool $include_bad Include physically deleted and invalid plugins? * @param mixed $site_guid Optional site guid * @return array */ -function elgg_get_plugins($status = 'active', $include_bad = false, $site_guid = NULL) { +function elgg_get_plugins($status = 'active', $site_guid = null) { $db_prefix = get_config('dbprefix'); $priority = elgg_namespace_plugin_private_setting('internal', 'priority'); @@ -388,22 +376,9 @@ function elgg_get_plugins($status = 'active', $include_bad = false, $site_guid = break; } - if ($include_bad) { - $old_ia = elgg_set_ignore_access(true); - } - + $old_ia = elgg_set_ignore_access(true); $plugins = elgg_get_entities_from_relationship($options); - - if ($include_bad) { - elgg_set_ignore_access($old_ia); - } else { - // remove bad plugins - foreach ($plugins as $i => $plugin) { - if (!$plugin->isValid()) { - unset ($plugins[$i]); - } - } - } + elgg_set_ignore_access($old_ia); return $plugins; } @@ -573,7 +548,7 @@ function elgg_get_plugins_provides($type = null, $name = null) { $provides = array(); foreach ($active_plugins as $plugin) { - if ($plugin_provides = $plugin->manifest->getProvides()) { + if ($plugin_provides = $plugin->getManifest()->getProvides()) { foreach ($plugin_provides as $provided) { $provides[$provided['type']][$provided['name']] = array( 'version' => $provided['version'], -- cgit v1.2.3 From 9672142684f84dd26f2520f8f33979e1c638041e Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 27 Apr 2011 03:02:43 +0000 Subject: Refs #3362. Removed use of $show_bad in elgg_get_plugins(). git-svn-id: http://code.elgg.org/elgg/trunk@9031 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/plugins.php | 3 ++- views/default/admin/plugins/advanced.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'engine/lib/plugins.php') diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 5aed3065a..31b69ce3d 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -380,6 +380,7 @@ function elgg_get_plugins($status = 'active', $site_guid = null) { $plugins = elgg_get_entities_from_relationship($options); elgg_set_ignore_access($old_ia); + $cache[$cache_hash] = $plugins; return $plugins; } @@ -397,7 +398,7 @@ function elgg_get_plugins($status = 'active', $site_guid = null) { function elgg_set_plugin_priorities(array $order) { $name = elgg_namespace_plugin_private_setting('internal', 'priority'); - $plugins = elgg_get_plugins('any', true); + $plugins = elgg_get_plugins('any'); if (!$plugins) { return false; } diff --git a/views/default/admin/plugins/advanced.php b/views/default/admin/plugins/advanced.php index 550154fcd..ea72bab5a 100644 --- a/views/default/admin/plugins/advanced.php +++ b/views/default/admin/plugins/advanced.php @@ -9,7 +9,7 @@ */ elgg_generate_plugin_entities(); -$installed_plugins = elgg_get_plugins('any', true); +$installed_plugins = elgg_get_plugins('any'); $show_category = get_input('category', null); // Get a list of the all categories -- cgit v1.2.3 From 312cab981f0b8dc8bb7e03d19460884b8d673aff Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 27 Apr 2011 19:39:54 +0000 Subject: Removed stray test code. git-svn-id: http://code.elgg.org/elgg/trunk@9032 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/plugins.php | 1 - 1 file changed, 1 deletion(-) (limited to 'engine/lib/plugins.php') diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 31b69ce3d..88217b782 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -380,7 +380,6 @@ function elgg_get_plugins($status = 'active', $site_guid = null) { $plugins = elgg_get_entities_from_relationship($options); elgg_set_ignore_access($old_ia); - $cache[$cache_hash] = $plugins; return $plugins; } -- cgit v1.2.3