]> source.dussan.org Git - nextcloud-server.git/commitdiff
disable timeout on app install via cli 19430/head
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Wed, 12 Feb 2020 12:31:11 +0000 (13:31 +0100)
committerArthur Schiwon <blizzz@arthur-schiwon.de>
Wed, 12 Feb 2020 15:52:45 +0000 (16:52 +0100)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
lib/private/Installer.php
lib/private/Server.php
tests/lib/InstallerTest.php

index 790bec0ddd58b2642f90f34288a53231a97924d1..b3919f22d03b5ac5d4f133ba20bf274e4edb3540 100644 (file)
@@ -70,6 +70,8 @@ class Installer {
        private $apps = null;
        /** @var bool|null - for caching the result of the ready status */
        private $isInstanceReadyForUpdates = null;
+       /** @var bool */
+       private $isCLI;
 
        /**
         * @param AppFetcher $appFetcher
@@ -78,16 +80,20 @@ class Installer {
         * @param ILogger $logger
         * @param IConfig $config
         */
-       public function __construct(AppFetcher $appFetcher,
-                                                               IClientService $clientService,
-                                                               ITempManager $tempManager,
-                                                               ILogger $logger,
-                                                               IConfig $config) {
+       public function __construct(
+               AppFetcher $appFetcher,
+               IClientService $clientService,
+               ITempManager $tempManager,
+               ILogger $logger,
+               IConfig $config,
+               bool $isCLI
+       ) {
                $this->appFetcher = $appFetcher;
                $this->clientService = $clientService;
                $this->tempManager = $tempManager;
                $this->logger = $logger;
                $this->config = $config;
+               $this->isCLI = $isCLI;
        }
 
        /**
@@ -270,8 +276,9 @@ class Installer {
 
                                // Download the release
                                $tempFile = $this->tempManager->getTemporaryFile('.tar.gz');
+                               $timeout = $this->isCLI ? 0 : 120;
                                $client = $this->clientService->newClient();
-                               $client->get($app['releases'][0]['download'], ['save_to' => $tempFile, 'timeout' => 120]);
+                               $client->get($app['releases'][0]['download'], ['save_to' => $tempFile, 'timeout' => $timeout]);
 
                                // Check if the signature actually matches the downloaded content
                                $certificate = openssl_get_publickey($app['certificate']);
index caaacab0a0a1e8095edd367ccdd75ca2b8f85903..d6c8e57d696f165ae5654e5bf33b40d6c35fb6e6 100644 (file)
@@ -1272,7 +1272,8 @@ class Server extends ServerContainer implements IServerContainer {
                                $c->getHTTPClientService(),
                                $c->getTempManager(),
                                $c->getLogger(),
-                               $c->getConfig()
+                               $c->getConfig(),
+                               \OC::$CLI
                        );
                });
 
index 01a2506270ad16716412f31489291722d27b153b..4530784e8e2f2270c33af007f6886d8f4aae8684 100644 (file)
@@ -57,7 +57,8 @@ class InstallerTest extends TestCase {
                        \OC::$server->getHTTPClientService(),
                        \OC::$server->getTempManager(),
                        \OC::$server->getLogger(),
-                       $config
+                       $config,
+                       false
                );
                $installer->removeApp(self::$appid);
        }
@@ -68,7 +69,8 @@ class InstallerTest extends TestCase {
                        $this->clientService,
                        $this->tempManager,
                        $this->logger,
-                       $this->config
+                       $this->config,
+                       false
                );
        }
 
@@ -78,7 +80,8 @@ class InstallerTest extends TestCase {
                        \OC::$server->getHTTPClientService(),
                        \OC::$server->getTempManager(),
                        \OC::$server->getLogger(),
-                       \OC::$server->getConfig()
+                       \OC::$server->getConfig(),
+                       false
                );
                $installer->removeApp(self::$appid);
                \OC::$server->getConfig()->setSystemValue('appstoreenabled', $this->appstore);
@@ -101,7 +104,8 @@ class InstallerTest extends TestCase {
                        \OC::$server->getHTTPClientService(),
                        \OC::$server->getTempManager(),
                        \OC::$server->getLogger(),
-                       \OC::$server->getConfig()
+                       \OC::$server->getConfig(),
+                       false
                );
                $this->assertNull(\OC::$server->getConfig()->getAppValue('testapp', 'enabled', null), 'Check that the app is not listed before installation');
                $this->assertSame('testapp', $installer->installApp(self::$appid));