aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-11 22:09:04 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-11 22:09:04 +0000
commit1f1a9d691360eac9bb3eeaf98ebaaec6b6305b2b (patch)
tree6156dc6a18928bcdd5c70d21e4843ed15f25c25b /engine/lib
parent4008723ba28caa13e3f8355a9c283e258437c01a (diff)
downloadelgg-1f1a9d691360eac9bb3eeaf98ebaaec6b6305b2b.tar.gz
elgg-1f1a9d691360eac9bb3eeaf98ebaaec6b6305b2b.tar.bz2
Fixes #2888: Plugins are checked for validity in elgg_get_plugins(). It won't return broken plugins unless specifically requested.
git-svn-id: http://code.elgg.org/elgg/trunk@8121 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/plugins.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index b33b8d0ac..2ac49e8df 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -350,12 +350,12 @@ 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_deleted Include physically deleted (and so inactive and disabled) plugins?
- * @param mixed $site_guid Optional site guid
+ * @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_deleted = false, $site_guid = NULL) {
+function elgg_get_plugins($status = 'active', $include_bad = false, $site_guid = NULL) {
$db_prefix = get_config('dbprefix');
$priority = elgg_namespace_plugin_private_setting('internal', 'priority');
@@ -394,14 +394,21 @@ function elgg_get_plugins($status = 'active', $include_deleted = false, $site_gu
break;
}
- if ($include_deleted) {
+ if ($include_bad) {
$old_id = elgg_set_ignore_access(true);
}
$plugins = elgg_get_entities_from_relationship($options);
- if ($include_deleted) {
+ if ($include_bad) {
elgg_set_ignore_access($old_ia);
+ } else {
+ // remove bad plugins
+ foreach ($plugins as $i => $plugin) {
+ if (!$plugin->isValid()) {
+ unset ($plugins[$i]);
+ }
+ }
}
return $plugins;