diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-12-10 21:42:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-10 21:42:58 +0100 |
commit | 582ce5a6ad7599d5ab0a1a23e96b7be9aabf95da (patch) | |
tree | 4365b135ab80555caa1776d09cbcd20fc41b71b3 /lib | |
parent | 55b2b58bf918121a9b5548680830a5f08ba253a8 (diff) | |
parent | 24237f1a34b17dbf819403179577d6cc178de313 (diff) | |
download | nextcloud-server-582ce5a6ad7599d5ab0a1a23e96b7be9aabf95da.tar.gz nextcloud-server-582ce5a6ad7599d5ab0a1a23e96b7be9aabf95da.zip |
Merge pull request #24416 from nextcloud/fix/app-store-check-php-compat
Check php compatibility of app store app releases
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/App/AppStore/Fetcher/AppFetcher.php | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php index 21ec38ead30..4dc517879e8 100644 --- a/lib/private/App/AppStore/Fetcher/AppFetcher.php +++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php @@ -101,14 +101,32 @@ class AppFetcher extends Fetcher { // Exclude all versions not compatible with the current version try { $versionParser = new VersionParser(); - $version = $versionParser->getVersion($release['rawPlatformVersionSpec']); + $serverVersion = $versionParser->getVersion($release['rawPlatformVersionSpec']); $ncVersion = $this->getVersion(); - $min = $version->getMinimumVersion(); - $max = $version->getMaximumVersion(); - $minFulfilled = $this->compareVersion->isCompatible($ncVersion, $min, '>='); - $maxFulfilled = $max !== '' && - $this->compareVersion->isCompatible($ncVersion, $max, '<='); - if ($minFulfilled && ($this->ignoreMaxVersion || $maxFulfilled)) { + $minServerVersion = $serverVersion->getMinimumVersion(); + $maxServerVersion = $serverVersion->getMaximumVersion(); + $minFulfilled = $this->compareVersion->isCompatible($ncVersion, $minServerVersion, '>='); + $maxFulfilled = $maxServerVersion !== '' && + $this->compareVersion->isCompatible($ncVersion, $maxServerVersion, '<='); + $isPhpCompatible = true; + if (($release['rawPhpVersionSpec'] ?? '*') !== '*') { + $phpVersion = $versionParser->getVersion($release['rawPhpVersionSpec']); + $minPhpVersion = $phpVersion->getMinimumVersion(); + $maxPhpVersion = $phpVersion->getMaximumVersion(); + $minPhpFulfilled = $minPhpVersion === '' || $this->compareVersion->isCompatible( + PHP_VERSION, + $minPhpVersion, + '>=' + ); + $maxPhpFulfilled = $maxPhpVersion === '' || $this->compareVersion->isCompatible( + PHP_VERSION, + $maxPhpVersion, + '<=' + ); + + $isPhpCompatible = $minPhpFulfilled && $maxPhpFulfilled; + } + if ($minFulfilled && ($this->ignoreMaxVersion || $maxFulfilled) && $isPhpCompatible) { $releases[] = $release; } } catch (\InvalidArgumentException $e) { |