diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-09-14 10:47:38 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-09-17 08:55:15 +0200 |
commit | 04eb1bb949f7db62c7b6d5c88a8fc1d6da935f70 (patch) | |
tree | da7ed58d552a8766efa5996c616e98c6ca28a016 /lib/private | |
parent | 364b96d5b9cf98839364eba2d20ac91ad5dfd834 (diff) | |
download | nextcloud-server-04eb1bb949f7db62c7b6d5c88a8fc1d6da935f70.tar.gz nextcloud-server-04eb1bb949f7db62c7b6d5c88a8fc1d6da935f70.zip |
Allow to specify supported architectures in appinfo.xml
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/App/DependencyAnalyzer.php | 24 | ||||
-rw-r--r-- | lib/private/App/Platform.php | 4 |
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php index 8e7cdde68e4..f63cb384b15 100644 --- a/lib/private/App/DependencyAnalyzer.php +++ b/lib/private/App/DependencyAnalyzer.php @@ -64,6 +64,7 @@ class DependencyAnalyzer { } return array_merge( + $this->analyzeArchitecture($dependencies), $this->analyzePhpVersion($dependencies), $this->analyzeDatabases($dependencies), $this->analyzeCommands($dependencies), @@ -174,6 +175,29 @@ class DependencyAnalyzer { return $missing; } + private function analyzeArchitecture(array $dependencies) { + $missing = []; + if (!isset($dependencies['architecture'])) { + return $missing; + } + + $supportedArchitectures = $dependencies['architecture']; + if (empty($supportedArchitectures)) { + return $missing; + } + if (!is_array($supportedArchitectures)) { + $supportedArchitectures = [$supportedArchitectures]; + } + $supportedArchitectures = array_map(function ($architecture) { + return $this->getValue($architecture); + }, $supportedArchitectures); + $currentArchitecture = $this->platform->getArchitecture(); + if (!in_array($currentArchitecture, $supportedArchitectures, true)) { + $missing[] = (string)$this->l->t('The following architectures are supported: %s', [implode(', ', $supportedArchitectures)]); + } + return $missing; + } + /** * @param array $dependencies * @return array diff --git a/lib/private/App/Platform.php b/lib/private/App/Platform.php index 4a64177232f..03e9c7d2767 100644 --- a/lib/private/App/Platform.php +++ b/lib/private/App/Platform.php @@ -97,4 +97,8 @@ class Platform { $repo = new PlatformRepository(); return $repo->findLibrary($name); } + + public function getArchitecture(): string { + return php_uname('m'); + } } |