Skip to content

Commit 302c10b

Browse files
authored
Merge pull request #14994 from nextcloud/feature/noid/pre-releases-for-beta-and-daily
Enable pre-releases for beta and daily channel
2 parents 0559b60 + 8e278a2 commit 302c10b

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

lib/private/App/AppStore/Fetcher/AppFetcher.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,17 @@ protected function fetch($ETag, $content) {
8383
/** @var mixed[] $response */
8484
$response = parent::fetch($ETag, $content);
8585

86+
$allowPreReleases = $this->getChannel() === 'beta' || $this->getChannel() === 'daily';
87+
$allowNightly = $this->getChannel() === 'daily';
88+
8689
foreach($response['data'] as $dataKey => $app) {
8790
$releases = [];
8891

8992
// Filter all compatible releases
9093
foreach($app['releases'] as $release) {
91-
// Exclude all nightly and pre-releases
92-
if($release['isNightly'] === false
93-
&& strpos($release['version'], '-') === false) {
94+
// Exclude all nightly and pre-releases if required
95+
if (($allowNightly || $release['isNightly'] === false)
96+
&& ($allowPreReleases || strpos($release['version'], '-') === false)) {
9497
// Exclude all versions not compatible with the current version
9598
try {
9699
$versionParser = new VersionParser();

lib/private/App/AppStore/Fetcher/Fetcher.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ abstract class Fetcher {
5757
protected $endpointUrl;
5858
/** @var string */
5959
protected $version;
60+
/** @var string */
61+
protected $channel;
6062

6163
/**
6264
* @param Factory $appDataFactory
@@ -197,4 +199,23 @@ protected function getVersion() {
197199
public function setVersion(string $version) {
198200
$this->version = $version;
199201
}
202+
203+
/**
204+
* Get the currently Nextcloud update channel
205+
* @return string
206+
*/
207+
protected function getChannel() {
208+
if ($this->channel === null) {
209+
$this->channel = \OC_Util::getChannel();
210+
}
211+
return $this->channel;
212+
}
213+
214+
/**
215+
* Set the current Nextcloud update channel
216+
* @param string $channel
217+
*/
218+
public function setChannel(string $channel) {
219+
$this->channel = $channel;
220+
}
200221
}

0 commit comments

Comments
 (0)