diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-09-17 12:22:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-17 12:22:42 +0200 |
commit | ec07ca2abbc88f395b8eeedc4b2e5b679018a673 (patch) | |
tree | ebeb07894b1855aa6dcd94c2bd970c2248324b1a /lib | |
parent | c9639f3956e4591f57718d3f2be512e4cdfd2bba (diff) | |
parent | 04eb1bb949f7db62c7b6d5c88a8fc1d6da935f70 (diff) | |
download | nextcloud-server-ec07ca2abbc88f395b8eeedc4b2e5b679018a673.tar.gz nextcloud-server-ec07ca2abbc88f395b8eeedc4b2e5b679018a673.zip |
Merge pull request #22844 from nextcloud/enh/richdocumentscode-arm
Support architecture limitations for apps and allow richdocumentscode_arm64 though htaccess
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/App/AppStore/Bundles/HubBundle.php | 12 | ||||
-rw-r--r-- | lib/private/App/DependencyAnalyzer.php | 24 | ||||
-rw-r--r-- | lib/private/App/Platform.php | 4 | ||||
-rw-r--r-- | lib/private/Setup.php | 2 |
4 files changed, 38 insertions, 4 deletions
diff --git a/lib/private/App/AppStore/Bundles/HubBundle.php b/lib/private/App/AppStore/Bundles/HubBundle.php index 501a4825772..301be810c5d 100644 --- a/lib/private/App/AppStore/Bundles/HubBundle.php +++ b/lib/private/App/AppStore/Bundles/HubBundle.php @@ -33,13 +33,19 @@ class HubBundle extends Bundle { } public function getAppIdentifiers() { - return [ + $hubApps = [ 'spreed', 'contacts', 'calendar', 'mail', - 'richdocumentscode', - 'richdocuments', ]; + + $architecture = php_uname('m'); + if (PHP_OS_FAMILY === 'Linux' && in_array($architecture, ['x86_64', 'aarch64'])) { + $hubApps[] = 'richdocuments'; + $hubApps[] = 'richdocumentscode' . ($architecture === 'aarch64' ? '_arm64' : ''); + } + + return $hubApps; } } 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'); + } } diff --git a/lib/private/Setup.php b/lib/private/Setup.php index cbfdcb2ee07..369447def2e 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -544,7 +544,7 @@ class Setup { $content .= "\n RewriteCond %{REQUEST_FILENAME} !/ocs-provider/"; $content .= "\n RewriteCond %{REQUEST_FILENAME} !/ocm-provider/"; $content .= "\n RewriteCond %{REQUEST_URI} !^/\\.well-known/(acme-challenge|pki-validation)/.*"; - $content .= "\n RewriteCond %{REQUEST_FILENAME} !/richdocumentscode/proxy.php$"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !/richdocumentscode(_arm64)?/proxy.php$"; $content .= "\n RewriteRule . index.php [PT,E=PATH_INFO:$1]"; $content .= "\n RewriteBase " . $rewriteBase; $content .= "\n <IfModule mod_env.c>"; |