diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-04-10 23:02:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-10 23:02:05 +0200 |
commit | 302c10b8362c9a5eb838883b47a6e96ade5671cc (patch) | |
tree | 62935dff83e449ede822fddac0589dd57566ce5f /lib | |
parent | 0559b604b2895c7c3c5d441c5f2cca13941e251a (diff) | |
parent | 8e278a2c3857147e649391b5905f8e373584f0e2 (diff) | |
download | nextcloud-server-302c10b8362c9a5eb838883b47a6e96ade5671cc.tar.gz nextcloud-server-302c10b8362c9a5eb838883b47a6e96ade5671cc.zip |
Merge pull request #14994 from nextcloud/feature/noid/pre-releases-for-beta-and-daily
Enable pre-releases for beta and daily channel
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/App/AppStore/Fetcher/AppFetcher.php | 9 | ||||
-rw-r--r-- | lib/private/App/AppStore/Fetcher/Fetcher.php | 21 |
2 files changed, 27 insertions, 3 deletions
diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php index 9ad8f582460..ea69c37f32c 100644 --- a/lib/private/App/AppStore/Fetcher/AppFetcher.php +++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php @@ -83,14 +83,17 @@ class AppFetcher extends Fetcher { /** @var mixed[] $response */ $response = parent::fetch($ETag, $content); + $allowPreReleases = $this->getChannel() === 'beta' || $this->getChannel() === 'daily'; + $allowNightly = $this->getChannel() === 'daily'; + foreach($response['data'] as $dataKey => $app) { $releases = []; // Filter all compatible releases foreach($app['releases'] as $release) { - // Exclude all nightly and pre-releases - if($release['isNightly'] === false - && strpos($release['version'], '-') === false) { + // Exclude all nightly and pre-releases if required + if (($allowNightly || $release['isNightly'] === false) + && ($allowPreReleases || strpos($release['version'], '-') === false)) { // Exclude all versions not compatible with the current version try { $versionParser = new VersionParser(); diff --git a/lib/private/App/AppStore/Fetcher/Fetcher.php b/lib/private/App/AppStore/Fetcher/Fetcher.php index 973c4e55e9f..db8c38ac686 100644 --- a/lib/private/App/AppStore/Fetcher/Fetcher.php +++ b/lib/private/App/AppStore/Fetcher/Fetcher.php @@ -57,6 +57,8 @@ abstract class Fetcher { protected $endpointUrl; /** @var string */ protected $version; + /** @var string */ + protected $channel; /** * @param Factory $appDataFactory @@ -197,4 +199,23 @@ abstract class Fetcher { public function setVersion(string $version) { $this->version = $version; } + + /** + * Get the currently Nextcloud update channel + * @return string + */ + protected function getChannel() { + if ($this->channel === null) { + $this->channel = \OC_Util::getChannel(); + } + return $this->channel; + } + + /** + * Set the current Nextcloud update channel + * @param string $channel + */ + public function setChannel(string $channel) { + $this->channel = $channel; + } } |