Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-04-09 07:23:18 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-04-09 07:23:18 +0400
commit918355e3705e258d2bdabf6a42b9ddc8fdfbfda4 (patch)
tree739a5e6b4344eabdc144feafaf3a11cd2529d324 /core/Plugin.php
parent50da9c7852080d6d6cc056dbf7030469f7e11b3a (diff)
refs #4967 started to work on verifying plugin version during run time and before update. Not 100% tested yet, especially not the updater yet
Diffstat (limited to 'core/Plugin.php')
-rw-r--r--core/Plugin.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/core/Plugin.php b/core/Plugin.php
index 3b06f7c6c6..1392fc3bc0 100644
--- a/core/Plugin.php
+++ b/core/Plugin.php
@@ -8,6 +8,7 @@
*/
namespace Piwik;
+use Piwik\Plugin\Dependency;
use Piwik\Plugin\MetadataLoader;
/**
@@ -276,6 +277,34 @@ class Plugin
}
/**
+ * Detect whether there are any missing dependencies.
+ *
+ * @param null $piwikVersion Defaults to the current Piwik version
+ * @return bool
+ */
+ public function hasMissingDependencies($piwikVersion = null)
+ {
+ $requirements = $this->getMissingDependencies($piwikVersion);
+
+ return !empty($requirements);
+ }
+
+ public function getMissingDependencies($piwikVersion = null)
+ {
+ if (empty($this->pluginInformation['require'])) {
+ return array();
+ }
+
+ $dependency = new Dependency();
+
+ if (!is_null($piwikVersion)) {
+ $dependency->setPiwikVersion($piwikVersion);
+ }
+
+ return $dependency->getMissingDependencies($this->pluginInformation['require']);
+ }
+
+ /**
* Extracts the plugin name from a backtrace array. Returns `false` if we can't find one.
*
* @param array $backtrace The result of {@link debug_backtrace()} or