Skip to content
Snippets Groups Projects
Unverified Commit 302c10b8 authored by Morris Jobke's avatar Morris Jobke Committed by GitHub
Browse files

Merge pull request #14994 from nextcloud/feature/noid/pre-releases-for-beta-and-daily

Enable pre-releases for beta and daily channel
parents 0559b604 8e278a2c
No related branches found
No related tags found
No related merge requests found
...@@ -83,14 +83,17 @@ class AppFetcher extends Fetcher { ...@@ -83,14 +83,17 @@ class AppFetcher extends Fetcher {
/** @var mixed[] $response */ /** @var mixed[] $response */
$response = parent::fetch($ETag, $content); $response = parent::fetch($ETag, $content);
$allowPreReleases = $this->getChannel() === 'beta' || $this->getChannel() === 'daily';
$allowNightly = $this->getChannel() === 'daily';
foreach($response['data'] as $dataKey => $app) { foreach($response['data'] as $dataKey => $app) {
$releases = []; $releases = [];
// Filter all compatible releases // Filter all compatible releases
foreach($app['releases'] as $release) { foreach($app['releases'] as $release) {
// Exclude all nightly and pre-releases // Exclude all nightly and pre-releases if required
if($release['isNightly'] === false if (($allowNightly || $release['isNightly'] === false)
&& strpos($release['version'], '-') === false) { && ($allowPreReleases || strpos($release['version'], '-') === false)) {
// Exclude all versions not compatible with the current version // Exclude all versions not compatible with the current version
try { try {
$versionParser = new VersionParser(); $versionParser = new VersionParser();
......
...@@ -57,6 +57,8 @@ abstract class Fetcher { ...@@ -57,6 +57,8 @@ abstract class Fetcher {
protected $endpointUrl; protected $endpointUrl;
/** @var string */ /** @var string */
protected $version; protected $version;
/** @var string */
protected $channel;
/** /**
* @param Factory $appDataFactory * @param Factory $appDataFactory
...@@ -197,4 +199,23 @@ abstract class Fetcher { ...@@ -197,4 +199,23 @@ abstract class Fetcher {
public function setVersion(string $version) { public function setVersion(string $version) {
$this->version = $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;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment