aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2011-08-27 10:41:35 -0700
committerBrett Profitt <brett.profitt@gmail.com>2011-08-27 10:41:35 -0700
commit0179e8c68b0827d77c61a31c8c0d6bf4a277c785 (patch)
tree5899e1172afcbfcfe642b14afd76183f93736ad4
parent79bc4476464e53d38a36f59f9a438f7592215951 (diff)
downloadelgg-0179e8c68b0827d77c61a31c8c0d6bf4a277c785.tar.gz
elgg-0179e8c68b0827d77c61a31c8c0d6bf4a277c785.tar.bz2
Fixes #3434. Manifests are checked more carefully on anything that checks deps. Disabling plugins with invalid manifests from admin page.
-rw-r--r--engine/classes/ElggPluginPackage.php6
-rw-r--r--engine/lib/plugins.php7
-rw-r--r--languages/en.php1
-rw-r--r--views/default/admin/plugins.php5
4 files changed, 17 insertions, 2 deletions
diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php
index 977b72d76..02b985285 100644
--- a/engine/classes/ElggPluginPackage.php
+++ b/engine/classes/ElggPluginPackage.php
@@ -334,7 +334,11 @@ class ElggPluginPackage {
// first, check if any active plugin conflicts with us.
foreach ($enabled_plugins as $plugin) {
- $temp_conflicts = $plugin->getManifest()->getConflicts();
+ $temp_conflicts = array();
+ $temp_manifest = $plugin->getManifest();
+ if ($temp_manifest instanceof ElggPluginManifest) {
+ $temp_conflicts = $plugin->getManifest()->getConflicts();
+ }
foreach ($temp_conflicts as $conflict) {
if ($conflict['type'] == 'plugin' && $conflict['name'] == $this_id) {
$result = $this->checkDepPlugin($conflict, $enabled_plugins, false);
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index 88217b782..ba98e94f1 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -548,7 +548,12 @@ function elgg_get_plugins_provides($type = null, $name = null) {
$provides = array();
foreach ($active_plugins as $plugin) {
- if ($plugin_provides = $plugin->getManifest()->getProvides()) {
+ $plugin_provides = array();
+ $manifest = $plugin->getManifest();
+ if ($manifest instanceof ElggPluginManifest) {
+ $plugin_provides = $plugin->getManifest()->getProvides();
+ }
+ if ($plugin_provides) {
foreach ($plugin_provides as $provided) {
$provides[$provided['type']][$provided['name']] = array(
'version' => $provided['version'],
diff --git a/languages/en.php b/languages/en.php
index c30a1bdd8..da5f0ef81 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -103,6 +103,7 @@ $english = array(
'ElggPlugin:Dependencies:Priority:Uninstalled' => '%s is not installed',
'ElggPlugin:Dependencies:Suggests:Unsatisfied' => 'Missing',
+ 'ElggPlugin:InvalidAndDeactivated' => '%s is an invalid plugin and has been deactivated.',
'InvalidParameterException:NonElggUser' => "Passing a non-ElggUser to an ElggUser constructor!",
diff --git a/views/default/admin/plugins.php b/views/default/admin/plugins.php
index 1aa899fcc..cd0b83c00 100644
--- a/views/default/admin/plugins.php
+++ b/views/default/admin/plugins.php
@@ -20,6 +20,11 @@ $categories = array();
foreach ($installed_plugins as $id => $plugin) {
if (!$plugin->isValid()) {
+ if ($plugin->isActive()) {
+ // force disable and warn
+ register_error(elgg_echo('ElggPlugin:InvalidAndDeactivated', array($plugin->getId())));
+ $plugin->deactivate();
+ }
continue;
}