aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggPlugin.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-14 23:07:31 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-14 23:07:31 +0000
commitbd28cf062af5f516e8c1b273577a530fc215255b (patch)
treedcca8a9cbcfe9fe961b6fef2b6a398be49a05b9e /engine/classes/ElggPlugin.php
parenteaf59ee54011c3dcc4ee7e344e0dd06160fd9bf4 (diff)
downloadelgg-bd28cf062af5f516e8c1b273577a530fc215255b.tar.gz
elgg-bd28cf062af5f516e8c1b273577a530fc215255b.tar.bz2
Fixes #2928: Invalid plugins are shown on the advance page with details about the problem and a link to the docs.
git-svn-id: http://code.elgg.org/elgg/trunk@8709 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/classes/ElggPlugin.php')
-rw-r--r--engine/classes/ElggPlugin.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php
index 69b3b1c67..55be2b887 100644
--- a/engine/classes/ElggPlugin.php
+++ b/engine/classes/ElggPlugin.php
@@ -14,6 +14,7 @@ class ElggPlugin extends ElggObject {
private $path;
private $pluginID;
+ private $errorMsg = '';
/**
* Set subtype to 'plugin'
@@ -86,6 +87,7 @@ class ElggPlugin extends ElggObject {
} catch (Exception $e) {
// we always have to allow the entity to load.
elgg_log("Failed to load $this->guid as a plugin. " . $e->getMessage(), 'WARNING');
+ $this->errorMsg = $e->getmessage();
}
}
@@ -547,14 +549,17 @@ class ElggPlugin extends ElggObject {
*/
public function isValid() {
if (!$this->getID()) {
+ $this->errorMsg = elgg_echo('ElggPlugin:NoId', array($this->guid));
return false;
}
if (!$this->package instanceof ElggPluginPackage) {
+ $this->errorMsg = elgg_echo('ElggPlugin:NoPluginPackagePackage', array($this->getID(), $this->guid));
return false;
}
if (!$this->package->isValid()) {
+ $this->errorMsg = $this->package->getError();
return false;
}
@@ -951,4 +956,13 @@ class ElggPlugin extends ElggObject {
return remove_entity_relationship($this->guid, 'active_plugin', $site->guid);
}
}
+
+ /**
+ * Returns the last error message registered.
+ *
+ * @return string|null
+ */
+ public function getError() {
+ return $this->errorMsg;
+ }
}