File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
lib/private/App/AppStore/Fetcher Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff 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 ();
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments