diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2011-10-02 11:18:55 -0700 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2011-10-02 11:18:55 -0700 |
commit | 58b66643c1921706d764b2bb1ea4729519ca31f8 (patch) | |
tree | 1154a0ecf822ba81f2751cfe805024d943d032f6 /engine/classes/ElggPlugin.php | |
parent | dd55b4b87cb1c89ceeb45ccf49ce648339a86041 (diff) | |
download | elgg-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/ElggPlugin.php')
-rw-r--r-- | engine/classes/ElggPlugin.php | 22 |
1 files changed, 21 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; |