summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-12-10 21:42:58 +0100
committerGitHub <noreply@github.com>2020-12-10 21:42:58 +0100
commit582ce5a6ad7599d5ab0a1a23e96b7be9aabf95da (patch)
tree4365b135ab80555caa1776d09cbcd20fc41b71b3 /lib
parent55b2b58bf918121a9b5548680830a5f08ba253a8 (diff)
parent24237f1a34b17dbf819403179577d6cc178de313 (diff)
downloadnextcloud-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.php32
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) {