aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/admin/plugins/activate.php4
-rw-r--r--actions/admin/plugins/activate_all.php4
-rw-r--r--actions/admin/plugins/deactivate.php4
-rw-r--r--actions/admin/plugins/deactivate_all.php4
-rw-r--r--actions/admin/plugins/set_priority.php4
-rw-r--r--engine/classes/ElggPlugin.php22
-rw-r--r--engine/classes/ElggPluginPackage.php2
-rw-r--r--languages/en.php4
8 files changed, 42 insertions, 6 deletions
diff --git a/actions/admin/plugins/activate.php b/actions/admin/plugins/activate.php
index 0049878e3..224b5a2ae 100644
--- a/actions/admin/plugins/activate.php
+++ b/actions/admin/plugins/activate.php
@@ -29,7 +29,9 @@ foreach ($plugin_guids as $guid) {
if ($plugin->activate()) {
$activated_guids[] = $guid;
} else {
- register_error(elgg_echo('admin:plugins:activate:no', array($plugin->getManifest()->getName())));
+ $msg = $plugin->getError();
+ $string = ($msg) ? 'admin:plugins:activate:no_with_msg' : 'admin:plugins:activate:no';
+ register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError())));
}
}
diff --git a/actions/admin/plugins/activate_all.php b/actions/admin/plugins/activate_all.php
index 19eb82142..19c142346 100644
--- a/actions/admin/plugins/activate_all.php
+++ b/actions/admin/plugins/activate_all.php
@@ -18,7 +18,9 @@ foreach ($guids as $guid) {
if ($plugin->activate()) {
//system_message(elgg_echo('admin:plugins:activate:yes', array($plugin->getManifest()->getName())));
} else {
- register_error(elgg_echo('admin:plugins:activate:no', array($plugin->getManifest()->getName())));
+ $msg = $plugin->getError();
+ $string = ($msg) ? 'admin:plugins:activate:no_with_msg' : 'admin:plugins:activate:no';
+ register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError())));
}
}
}
diff --git a/actions/admin/plugins/deactivate.php b/actions/admin/plugins/deactivate.php
index f5eca3aaa..2ce796eff 100644
--- a/actions/admin/plugins/deactivate.php
+++ b/actions/admin/plugins/deactivate.php
@@ -28,7 +28,9 @@ foreach ($plugin_guids as $guid) {
if ($plugin->deactivate()) {
//system_message(elgg_echo('admin:plugins:deactivate:yes', array($plugin->getManifest()->getName())));
} else {
- register_error(elgg_echo('admin:plugins:deactivate:no', array($plugin->getManifest()->getName())));
+ $msg = $plugin->getError();
+ $string = ($msg) ? 'admin:plugins:deactivate:no_with_msg' : 'admin:plugins:deactivate:no';
+ register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError())));
}
}
diff --git a/actions/admin/plugins/deactivate_all.php b/actions/admin/plugins/deactivate_all.php
index 436a3ad30..479e9c607 100644
--- a/actions/admin/plugins/deactivate_all.php
+++ b/actions/admin/plugins/deactivate_all.php
@@ -18,7 +18,9 @@ foreach ($guids as $guid) {
if ($plugin->deactivate()) {
//system_message(elgg_echo('admin:plugins:activate:yes', array($plugin->getManifest()->getName())));
} else {
- register_error(elgg_echo('admin:plugins:deactivate:no', array($plugin->getManifest()->getName())));
+ $msg = $plugin->getError();
+ $string = ($msg) ? 'admin:plugins:deactivate:no_with_msg' : 'admin:plugins:deactivate:no';
+ register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError())));
}
}
}
diff --git a/actions/admin/plugins/set_priority.php b/actions/admin/plugins/set_priority.php
index 1f8bc24af..79b1c4c53 100644
--- a/actions/admin/plugins/set_priority.php
+++ b/actions/admin/plugins/set_priority.php
@@ -26,7 +26,9 @@ if (!($plugin instanceof ElggPlugin)) {
if ($plugin->setPriority($priority)) {
//system_message(elgg_echo('admin:plugins:set_priority:yes', array($plugin->getManifest()->getName())));
} else {
- register_error(elgg_echo('admin:plugins:set_priority:no', array($plugin->getManifest()->getName())));
+ $msg = $plugin->getError();
+ $string = ($msg) ? 'admin:plugins:set_priority:no_with_msg' : 'admin:plugins:set_priority:no';
+ register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError())));
}
// don't regenerate the simplecache because the plugin won't be
diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php
index d837431fc..4aee1e898 100644
--- a/engine/classes/ElggPlugin.php
+++ b/engine/classes/ElggPlugin.php
@@ -116,6 +116,21 @@ class ElggPlugin extends ElggObject {
}
/**
+ * Returns the manifest's name if available, otherwise the ID.
+ *
+ * @return string
+ * @since 1.8.1
+ */
+ public function getFriendlyName() {
+ $manifest = $this->getManifest();
+ if ($manifest) {
+ return $manifest->getName();
+ }
+
+ return $this->getID();
+ }
+
+ /**
* Returns the plugin's full path with trailing slash.
*
* @return string
@@ -597,7 +612,12 @@ class ElggPlugin extends ElggObject {
*/
public function canActivate($site_guid = null) {
if ($this->getPackage()) {
- return $this->getPackage()->isValid() && $this->getPackage()->checkDependencies();
+ $result = $this->getPackage()->isValid() && $this->getPackage()->checkDependencies();
+ if (!$result) {
+ $this->errorMsg = $this->getPackage()->getError();
+ }
+
+ return $result;
}
return false;
diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php
index 02b985285..145f71fcd 100644
--- a/engine/classes/ElggPluginPackage.php
+++ b/engine/classes/ElggPluginPackage.php
@@ -347,6 +347,7 @@ class ElggPluginPackage {
$conflict['name'] = $plugin->getManifest()->getName();
if (!$full_report && !$result['status']) {
+ $this->errorMsg = "Conflicts with plugin \"{$plugin->getManifest()->getName()}\".";
return $result['status'];
} else {
$report[] = array(
@@ -399,6 +400,7 @@ class ElggPluginPackage {
// unless we're doing a full report, break as soon as we fail.
if (!$full_report && !$result['status']) {
+ $this->errorMsg = "Missing dependencies.";
return $result['status'];
} else {
// build report element and comment
diff --git a/languages/en.php b/languages/en.php
index 27b07d11c..c4eb212c4 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -69,6 +69,7 @@ $english = array(
'PluginException:InvalidManifest' => 'Invalid manifest file for plugin %s',
'PluginException:InvalidPlugin' => '%s is not a valid plugin.',
'PluginException:InvalidPlugin:Details' => '%s is not a valid plugin: %s',
+ 'PluginException:NullInstantiated' => 'ElggPlugin cannot be null instantiated. You must pass a GUID, a plugin ID, or a full path.',
'ElggPlugin:MissingID' => 'Missing plugin ID (guid %s)',
'ElggPlugin:NoPluginPackagePackage' => 'Missing ElggPluginPackage for plugin ID %s (guid %s)',
@@ -663,10 +664,13 @@ $english = array(
'admin:plugins:set_priority:yes' => "Reordered %s.",
'admin:plugins:set_priority:no' => "Could not reorder %s.",
+ 'admin:plugins:set_priority:no_with_msg' => "Could not reorder %s. Error: %s",
'admin:plugins:deactivate:yes' => "Deactivated %s.",
'admin:plugins:deactivate:no' => "Could not deactivate %s.",
+ 'admin:plugins:deactivate:no_with_msg' => "Could not deactivate %s. Error: %s",
'admin:plugins:activate:yes' => "Activated %s.",
'admin:plugins:activate:no' => "Could not activate %s.",
+ 'admin:plugins:activate:no_with_msg' => "Could not activate %s. Error: %s",
'admin:plugins:categories:all' => 'All categories',
'admin:plugins:plugin_website' => 'Plugin website',
'admin:plugins:author' => '%s',