summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-12-05 15:28:33 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2014-12-11 12:02:12 +0100
commit5a03e0a5cf30f4ad5cecd7a90ad3bc2a004770aa (patch)
treee8429231ef714254ae135b4fb7dc3bb82e89ddfe /lib
parentee46548f57310b45ce723fd03ec29bfb686f8bc2 (diff)
downloadnextcloud-server-5a03e0a5cf30f4ad5cecd7a90ad3bc2a004770aa.tar.gz
nextcloud-server-5a03e0a5cf30f4ad5cecd7a90ad3bc2a004770aa.zip
adding dependency to owncloud version - with fallback to requiremin and requiremax
Diffstat (limited to 'lib')
-rw-r--r--lib/private/app/dependencyanalyzer.php27
-rw-r--r--lib/private/app/platform.php8
2 files changed, 35 insertions, 0 deletions
diff --git a/lib/private/app/dependencyanalyzer.php b/lib/private/app/dependencyanalyzer.php
index 2e838872385..795017e2b37 100644
--- a/lib/private/app/dependencyanalyzer.php
+++ b/lib/private/app/dependencyanalyzer.php
@@ -26,6 +26,8 @@ class DependencyAnalyzer {
/** @var array */
private $dependencies = array();
+ private $appInfo = array();
+
/**
* @param array $app
* @param Platform $platform
@@ -49,6 +51,7 @@ class DependencyAnalyzer {
$this->analyzeCommands();
$this->analyzeLibraries();
$this->analyzeOS();
+ $this->analyzeOC();
return $this->missing;
}
@@ -154,7 +157,31 @@ class DependencyAnalyzer {
}
}
+ private function analyzeOC() {
+ $minVersion = null;
+ if (isset($this->dependencies['owncloud']['@attributes']['min-version'])) {
+ $minVersion = $this->dependencies['owncloud']['@attributes']['min-version'];
+ } elseif (isset($this->appInfo['requiremin'])) {
+ $minVersion = $this->appInfo['requiremin'];
+ }
+ $maxVersion = null;
+ if (isset($this->dependencies['oc']['@attributes']['max-version'])) {
+ $maxVersion = $this->dependencies['oc']['@attributes']['max-version'];
+ } elseif (isset($this->appInfo['requiremax'])) {
+ $maxVersion = $this->appInfo['requiremax'];
+ }
+ if (!is_null($minVersion)) {
+ if (version_compare($this->platform->getOcVersion(), $minVersion, '<')) {
+ $this->addMissing((string)$this->l->t('ownCloud %s or higher is required.', $minVersion));
+ }
+ }
+ if (!is_null($maxVersion)) {
+ if (version_compare($this->platform->getOcVersion(), $maxVersion, '>')) {
+ $this->addMissing((string)$this->l->t('ownCloud with a version lower than %s is required.', $maxVersion));
+ }
+ }
+ }
/**
* @param $element
diff --git a/lib/private/app/platform.php b/lib/private/app/platform.php
index 6279bb5f20c..ba96fba00db 100644
--- a/lib/private/app/platform.php
+++ b/lib/private/app/platform.php
@@ -10,6 +10,7 @@
namespace OC\App;
+use OC_Util;
use OCP\IConfig;
/**
@@ -38,6 +39,13 @@ class Platform {
/**
* @return string
*/
+ public function getOcVersion() {
+ return OC_Util::getVersion();
+ }
+
+ /**
+ * @return string
+ */
public function getDatabase() {
$dbType = $this->config->getSystemValue('dbtype', 'sqlite');
if ($dbType === 'sqlite3') {