Merge pull request #2327 from nextcloud/exclude-pre-releases

Exclude pre-release versions as per SemVer
This commit is contained in:
Christoph Wurst 2016-11-28 09:55:24 +01:00 committed by GitHub
commit ad610ae772
2 changed files with 45 additions and 23 deletions

View File

@ -79,17 +79,18 @@ class AppFetcher extends Fetcher {
// Filter all compatible releases // Filter all compatible releases
foreach($app['releases'] as $release) { foreach($app['releases'] as $release) {
// Exclude all nightly releases // Exclude all nightly and pre-releases
if($release['isNightly'] === false) { if($release['isNightly'] === false
&& strpos($release['version'], '-') === false) {
// Exclude all versions not compatible with the current version // Exclude all versions not compatible with the current version
$versionParser = new VersionParser(); $versionParser = new VersionParser();
$version = $versionParser->getVersion($release['rawPlatformVersionSpec']); $version = $versionParser->getVersion($release['rawPlatformVersionSpec']);
if (
if(
// Major version is bigger or equals to the minimum version of the app // Major version is bigger or equals to the minimum version of the app
version_compare($ncMajorVersion, $version->getMinimumVersion(), '>=') version_compare($ncMajorVersion, $version->getMinimumVersion(), '>=')
// Major version is smaller or equals to the maximum version of the app // Major version is smaller or equals to the maximum version of the app
&& version_compare($ncMajorVersion, $version->getMaximumVersion(), '<=')) { && version_compare($ncMajorVersion, $version->getMaximumVersion(), '<=')
) {
$releases[] = $release; $releases[] = $release;
} }
} }
@ -118,6 +119,7 @@ class AppFetcher extends Fetcher {
} }
} }
$response['data'] = array_values($response['data']);
return $response; return $response;
} }
} }

File diff suppressed because one or more lines are too long