aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2022-03-11 14:26:30 +0100
committerGitHub <noreply@github.com>2022-03-11 14:26:30 +0100
commitdb1c2a5375d5a21aaaf35615b247c0e0f33a815e (patch)
tree5551b16a62ee36ff61641552c5406af1e0b91f82
parent4ac4f4b0a6c4b00039b22dcc800551dd50006d08 (diff)
parent21f96308c4966b468eba4e75dabe49977d52be3f (diff)
downloadnextcloud-server-db1c2a5375d5a21aaaf35615b247c0e0f33a815e.tar.gz
nextcloud-server-db1c2a5375d5a21aaaf35615b247c0e0f33a815e.zip
Merge pull request #31511 from nextcloud/bugfix/noid/allow-installing-unstable-versions
Allow installing unstable app versions based on channel and with `--allow-unstable` just like on updates
-rw-r--r--core/Command/App/Install.php8
-rw-r--r--lib/private/App/AppStore/Fetcher/AppFetcher.php8
-rw-r--r--tests/lib/App/AppStore/Fetcher/AppFetcherTest.php24
3 files changed, 27 insertions, 13 deletions
diff --git a/core/Command/App/Install.php b/core/Command/App/Install.php
index 30fd96a95b1..a699a2e7af0 100644
--- a/core/Command/App/Install.php
+++ b/core/Command/App/Install.php
@@ -56,6 +56,12 @@ class Install extends Command {
InputOption::VALUE_NONE,
'install the app regardless of the Nextcloud version requirement'
)
+ ->addOption(
+ 'allow-unstable',
+ null,
+ InputOption::VALUE_NONE,
+ 'allow installing an unstable releases'
+ )
;
}
@@ -71,7 +77,7 @@ class Install extends Command {
try {
/** @var Installer $installer */
$installer = \OC::$server->query(Installer::class);
- $installer->downloadApp($appId);
+ $installer->downloadApp($appId, $input->getOption('allow-unstable'));
$result = $installer->installApp($appId, $forceEnable);
} catch (\Exception $e) {
$output->writeln('Error: ' . $e->getMessage());
diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php
index 6c201978e1f..579f350b5bb 100644
--- a/lib/private/App/AppStore/Fetcher/AppFetcher.php
+++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php
@@ -90,8 +90,8 @@ class AppFetcher extends Fetcher {
return [];
}
- $allowPreReleases = $allowUnstable || $this->getChannel() === 'beta' || $this->getChannel() === 'daily';
- $allowNightly = $allowUnstable || $this->getChannel() === 'daily';
+ $allowPreReleases = $allowUnstable || $this->getChannel() === 'beta' || $this->getChannel() === 'daily' || $this->getChannel() === 'git';
+ $allowNightly = $allowUnstable || $this->getChannel() === 'daily' || $this->getChannel() === 'git';
foreach ($response['data'] as $dataKey => $app) {
$releases = [];
@@ -183,7 +183,9 @@ class AppFetcher extends Fetcher {
public function get($allowUnstable = false) {
- $apps = parent::get($allowUnstable);
+ $allowPreReleases = $allowUnstable || $this->getChannel() === 'beta' || $this->getChannel() === 'daily' || $this->getChannel() === 'git';
+
+ $apps = parent::get($allowPreReleases);
$allowList = $this->config->getSystemValue('appsallowlist');
// If the admin specified a allow list, filter apps from the appstore
diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
index 14a7569a64e..4746c296ab4 100644
--- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
@@ -1854,15 +1854,21 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
$this->logger = $this->createMock(LoggerInterface::class);
$this->registry = $this->createMock(IRegistry::class);
- $this->fetcher = new AppFetcher(
- $factory,
- $this->clientService,
- $this->timeFactory,
- $this->config,
- $this->compareVersion,
- $this->logger,
- $this->registry
- );
+ $this->fetcher = $this->getMockBuilder(AppFetcher::class)
+ ->setMethods(['getChannel'])
+ ->setConstructorArgs([
+ $factory,
+ $this->clientService,
+ $this->timeFactory,
+ $this->config,
+ $this->compareVersion,
+ $this->logger,
+ $this->registry,
+ ])
+ ->getMock();
+
+ $this->fetcher->method('getChannel')
+ ->willReturn('stable');
}
public function testGetWithFilter() {