summaryrefslogtreecommitdiffstats
path: root/lib/private/app/dependencyanalyzer.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-12-11 15:37:45 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2014-12-11 15:37:45 +0100
commit6566dc83e798b0956c1646b0a4e91873cc08bb9a (patch)
treeb6e3bf8831c8fa92aa165a9333f120127dbb8d33 /lib/private/app/dependencyanalyzer.php
parent95fc5addec189d21f4d714e3863c81d85d95ce09 (diff)
downloadnextcloud-server-6566dc83e798b0956c1646b0a4e91873cc08bb9a.tar.gz
nextcloud-server-6566dc83e798b0956c1646b0a4e91873cc08bb9a.zip
single dependencies will not be represented as an array + fix unit tests
Diffstat (limited to 'lib/private/app/dependencyanalyzer.php')
-rw-r--r--lib/private/app/dependencyanalyzer.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/private/app/dependencyanalyzer.php b/lib/private/app/dependencyanalyzer.php
index 795017e2b37..92f65be1cd2 100644
--- a/lib/private/app/dependencyanalyzer.php
+++ b/lib/private/app/dependencyanalyzer.php
@@ -79,6 +79,9 @@ class DependencyAnalyzer {
if (empty($supportedDatabases)) {
return;
}
+ if (!is_array($supportedDatabases)) {
+ $supportedDatabases = array($supportedDatabases);
+ }
$supportedDatabases = array_map(function($db) {
return $this->getValue($db);
}, $supportedDatabases);
@@ -94,6 +97,9 @@ class DependencyAnalyzer {
}
$commands = $this->dependencies['command'];
+ if (!is_array($commands)) {
+ $commands = array($commands);
+ }
$os = $this->platform->getOS();
foreach($commands as $command) {
if (isset($command['@attributes']['os']) && $command['@attributes']['os'] !== $os) {
@@ -112,6 +118,9 @@ class DependencyAnalyzer {
}
$libs = $this->dependencies['lib'];
+ if (!is_array($libs)) {
+ $libs = array($libs);
+ }
foreach($libs as $lib) {
$libName = $this->getValue($lib);
$libVersion = $this->platform->getLibraryVersion($libName);
@@ -148,9 +157,13 @@ class DependencyAnalyzer {
if (empty($oss)) {
return;
}
- $oss = array_map(function($os) {
- return $this->getValue($os);
- }, $oss);
+ if (is_array($oss)) {
+ $oss = array_map(function ($os) {
+ return $this->getValue($os);
+ }, $oss);
+ } else {
+ $oss = array($oss);
+ }
$currentOS = $this->platform->getOS();
if (!in_array($currentOS, $oss)) {
$this->addMissing((string)$this->l->t('Following platforms are supported: %s', join(', ', $oss)));
@@ -165,8 +178,8 @@ class DependencyAnalyzer {
$minVersion = $this->appInfo['requiremin'];
}
$maxVersion = null;
- if (isset($this->dependencies['oc']['@attributes']['max-version'])) {
- $maxVersion = $this->dependencies['oc']['@attributes']['max-version'];
+ if (isset($this->dependencies['owncloud']['@attributes']['max-version'])) {
+ $maxVersion = $this->dependencies['owncloud']['@attributes']['max-version'];
} elseif (isset($this->appInfo['requiremax'])) {
$maxVersion = $this->appInfo['requiremax'];
}
@@ -190,7 +203,7 @@ class DependencyAnalyzer {
private function getValue($element) {
if (isset($element['@value']))
return $element['@value'];
- return strval($element);
+ return (string)$element;
}
/**