diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2020-04-30 09:43:33 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2020-08-07 13:51:39 +0200 |
commit | 9e962fb69f0afa12eeec3d2e412648a5e432588c (patch) | |
tree | 5277d4d9e6aebf3ad7bb18fc530507abd945a7e9 /lib/private/App | |
parent | a3d30bf4a23f3827103dd3ba5e10c16a58362a80 (diff) | |
download | nextcloud-server-9e962fb69f0afa12eeec3d2e412648a5e432588c.tar.gz nextcloud-server-9e962fb69f0afa12eeec3d2e412648a5e432588c.zip |
Allow to update to nightly
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib/private/App')
-rw-r--r-- | lib/private/App/AppStore/Fetcher/AppFetcher.php | 7 | ||||
-rw-r--r-- | lib/private/App/AppStore/Fetcher/Fetcher.php | 14 |
2 files changed, 15 insertions, 6 deletions
diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php index e4c2ba4e85e..f108d23dd9b 100644 --- a/lib/private/App/AppStore/Fetcher/AppFetcher.php +++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php @@ -78,15 +78,16 @@ class AppFetcher extends Fetcher { * * @param string $ETag * @param string $content + * @param bool [$allowUnstable] Allow unstable releases * * @return array */ - protected function fetch($ETag, $content) { + protected function fetch($ETag, $content, $allowUnstable = false) { /** @var mixed[] $response */ $response = parent::fetch($ETag, $content); - $allowPreReleases = $this->getChannel() === 'beta' || $this->getChannel() === 'daily'; - $allowNightly = $this->getChannel() === 'daily'; + $allowPreReleases = $allowUnstable || $this->getChannel() === 'beta' || $this->getChannel() === 'daily'; + $allowNightly = $allowUnstable || $this->getChannel() === 'daily'; foreach ($response['data'] as $dataKey => $app) { $releases = []; diff --git a/lib/private/App/AppStore/Fetcher/Fetcher.php b/lib/private/App/AppStore/Fetcher/Fetcher.php index 500a0568c99..fcb837ee162 100644 --- a/lib/private/App/AppStore/Fetcher/Fetcher.php +++ b/lib/private/App/AppStore/Fetcher/Fetcher.php @@ -129,9 +129,10 @@ abstract class Fetcher { /** * Returns the array with the categories on the appstore server * + * @param bool [$allowUnstable] Allow unstable releases * @return array */ - public function get() { + public function get($allowUnstable = false) { $appstoreenabled = $this->config->getSystemValue('appstoreenabled', true); $internetavailable = $this->config->getSystemValue('has_internet_connection', true); @@ -148,7 +149,9 @@ abstract class Fetcher { // File does already exists $file = $rootFolder->getFile($this->fileName); $jsonBlob = json_decode($file->getContent(), true); - if (is_array($jsonBlob)) { + + // Always get latests apps info if $allowUnstable + if (!$allowUnstable && is_array($jsonBlob)) { // No caching when the version has been updated if (isset($jsonBlob['ncversion']) && $jsonBlob['ncversion'] === $this->getVersion()) { @@ -171,7 +174,12 @@ abstract class Fetcher { // Refresh the file content try { - $responseJson = $this->fetch($ETag, $content); + $responseJson = $this->fetch($ETag, $content, $allowUnstable); + // Don't store the apps request file + if ($allowUnstable) { + return $responseJson['data']; + } + $file->putContent(json_encode($responseJson)); return json_decode($file->getContent(), true)['data']; } catch (ConnectException $e) { |