From 58b66643c1921706d764b2bb1ea4729519ca31f8 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Sun, 2 Oct 2011 11:18:55 -0700 Subject: Fixes #3915. Added ElggPlugin->getFriendlyName() to check for manifest->getName() first, then for plugin ID. Added better descriptions for plugin activation errors. --- engine/classes/ElggPlugin.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'engine/classes/ElggPlugin.php') 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 @@ -115,6 +115,21 @@ class ElggPlugin extends ElggObject { return $this->title; } + /** + * 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. * @@ -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; -- cgit v1.2.3