aboutsummaryrefslogtreecommitdiff
path: root/engine/classes
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2011-10-02 11:18:55 -0700
committerBrett Profitt <brett.profitt@gmail.com>2011-10-02 11:18:55 -0700
commit58b66643c1921706d764b2bb1ea4729519ca31f8 (patch)
tree1154a0ecf822ba81f2751cfe805024d943d032f6 /engine/classes
parentdd55b4b87cb1c89ceeb45ccf49ce648339a86041 (diff)
downloadelgg-58b66643c1921706d764b2bb1ea4729519ca31f8.tar.gz
elgg-58b66643c1921706d764b2bb1ea4729519ca31f8.tar.bz2
Fixes #3915. Added ElggPlugin->getFriendlyName() to check for manifest->getName() first, then for plugin ID. Added better descriptions for plugin activation errors.
Diffstat (limited to 'engine/classes')
-rw-r--r--engine/classes/ElggPlugin.php22
-rw-r--r--engine/classes/ElggPluginPackage.php2
2 files changed, 23 insertions, 1 deletions
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