diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-12-02 11:49:31 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-12-04 11:40:33 +0100 |
commit | b028a6afac6964a4c07ce83ed0f43969ab587117 (patch) | |
tree | ef9cf4dd5e65bdc40b577d74285cc8eff5fadd36 /lib/private/app | |
parent | c80ec91f281419e59b3fd2ce2668278e440d6768 (diff) | |
download | nextcloud-server-b028a6afac6964a4c07ce83ed0f43969ab587117.tar.gz nextcloud-server-b028a6afac6964a4c07ce83ed0f43969ab587117.zip |
adjust dependency analyzer to use attributes properly
Diffstat (limited to 'lib/private/app')
-rw-r--r-- | lib/private/app/dependencyanalyzer.php | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/lib/private/app/dependencyanalyzer.php b/lib/private/app/dependencyanalyzer.php index 7fd181c076c..ae5ecf76cd1 100644 --- a/lib/private/app/dependencyanalyzer.php +++ b/lib/private/app/dependencyanalyzer.php @@ -12,13 +12,25 @@ namespace OC\App; class DependencyAnalyzer { + /** @var Platform */ + private $system; + + /** @var \OCP\IL10N */ + private $l; + + /** @var array */ + private $missing; + + /** @var array */ + private $dependencies; + /** * @param array $app - * @param Platform $system + * @param Platform $platform * @param \OCP\IL10N $l */ - function __construct(array $app, $system, $l) { - $this->system = $system; + function __construct(array $app, $platform, $l) { + $this->system = $platform; $this->l = $l; $this->missing = array(); $this->dependencies = array(); @@ -38,18 +50,14 @@ class DependencyAnalyzer { } private function analysePhpVersion() { - if (!array_key_exists('php', $this->dependencies)) { - return; - } - - if (array_key_exists('min-version', $this->dependencies['php'])) { - $minVersion = $this->dependencies['php']['min-version']; + if (isset($this->dependencies['php']['@attributes']['min-version'])) { + $minVersion = $this->dependencies['php']['@attributes']['min-version']; if (version_compare($this->system->getPhpVersion(), $minVersion, '<')) { $this->missing[] = (string)$this->l->t('PHP %s or higher is required.', $minVersion); } } - if (array_key_exists('max-version', $this->dependencies['php'])) { - $maxVersion = $this->dependencies['php']['max-version']; + if (isset($this->dependencies['php']['@attributes']['max-version'])) { + $maxVersion = $this->dependencies['php']['@attributes']['max-version']; if (version_compare($this->system->getPhpVersion(), $maxVersion, '>')) { $this->missing[] = (string)$this->l->t('PHP with a version less then %s is required.', $maxVersion); } @@ -57,18 +65,23 @@ class DependencyAnalyzer { } private function analyseSupportedDatabases() { - if (!array_key_exists('database', $this->dependencies)) { + if (!isset($this->dependencies['databases'])) { return; } - $supportedDatabases = $this->dependencies['database']; + $supportedDatabases = $this->dependencies['databases']; if (empty($supportedDatabases)) { return; } + $supportedDatabases = array_map(function($db) { + if (isset($db['@value'])) { + return $db['@value']; + } + return $db; + }, $supportedDatabases); $currentDatabase = $this->system->getDatabase(); if (!in_array($currentDatabase, $supportedDatabases)) { $this->missing[] = (string)$this->l->t('Following databases are supported: %s', join(', ', $supportedDatabases)); } } - } |