From a4111d4846d1b77e4add0d9d60fb52b633f115d6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 10 Mar 2022 08:21:31 +0100 Subject: Allow installing unstable versions Signed-off-by: Joas Schilling --- core/Command/App/Install.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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()); -- cgit v1.2.3 From 4f9c8b08ca08b3ceb29fd47127359d7f2416d915 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 10 Mar 2022 08:29:41 +0100 Subject: Similar to the fetch() method respect the channel in the get() Signed-off-by: Joas Schilling --- lib/private/App/AppStore/Fetcher/AppFetcher.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php index 6c201978e1f..075c4853c34 100644 --- a/lib/private/App/AppStore/Fetcher/AppFetcher.php +++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php @@ -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'; + + $apps = parent::get($allowPreReleases); $allowList = $this->config->getSystemValue('appsallowlist'); // If the admin specified a allow list, filter apps from the appstore -- cgit v1.2.3 From a9ba631e4d50ef1d06d67b8b501295d86ff6f7d9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 10 Mar 2022 08:30:50 +0100 Subject: Also allow pre-releases and nightlies when installing from git Signed-off-by: Joas Schilling --- lib/private/App/AppStore/Fetcher/AppFetcher.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php index 075c4853c34..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,7 @@ class AppFetcher extends Fetcher { public function get($allowUnstable = false) { - $allowPreReleases = $allowUnstable || $this->getChannel() === 'beta' || $this->getChannel() === 'daily'; + $allowPreReleases = $allowUnstable || $this->getChannel() === 'beta' || $this->getChannel() === 'daily' || $this->getChannel() === 'git'; $apps = parent::get($allowPreReleases); $allowList = $this->config->getSystemValue('appsallowlist'); -- cgit v1.2.3 From 21f96308c4966b468eba4e75dabe49977d52be3f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 10 Mar 2022 16:16:30 +0100 Subject: Overwrite the channel Signed-off-by: Joas Schilling --- tests/lib/App/AppStore/Fetcher/AppFetcherTest.php | 24 ++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) 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() { -- cgit v1.2.3