]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(setup): ignore long session login during installation 47550/head
authorMaxence Lange <maxence@artificial-owl.com>
Tue, 27 Aug 2024 13:29:04 +0000 (12:29 -0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Tue, 27 Aug 2024 19:14:03 +0000 (19:14 +0000)
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
lib/base.php
lib/private/Session/Internal.php

index bf324e946bc509b705ba35457b18c8b85e2ed647..4e66d389e7b12f97d23bd95f285ec07d2aa7bdbf 100644 (file)
@@ -387,10 +387,15 @@ class OC {
                $sessionName = OC_Util::getInstanceId();
 
                try {
+                       $logger = null;
+                       if (Server::get(\OC\SystemConfig::class)->getValue('installed', false)) {
+                               $logger = logger('core');
+                       }
+
                        // set the session name to the instance id - which is unique
                        $session = new \OC\Session\Internal(
                                $sessionName,
-                               logger('core'),
+                               $logger,
                        );
 
                        $cryptoWrapper = Server::get(\OC\Session\CryptoWrapper::class);
index 5398dc710af9c39d8fde2060489c0dbec05066ef..b465bcd3edadbf7bfebf8aeb2286aa19479d91bd 100644 (file)
@@ -29,8 +29,10 @@ class Internal extends Session {
         * @param string $name
         * @throws \Exception
         */
-       public function __construct(string $name,
-               private LoggerInterface $logger) {
+       public function __construct(
+               string $name,
+               private ?LoggerInterface $logger,
+       ) {
                set_error_handler([$this, 'trapError']);
                $this->invoke('session_name', [$name]);
                $this->invoke('session_cache_limiter', ['']);
@@ -204,7 +206,7 @@ class Internal extends Session {
                                        $timeSpent > 0.5 => ILogger::INFO,
                                        default => ILogger::DEBUG,
                                };
-                               $this->logger->log(
+                               $this->logger?->log(
                                        $logLevel,
                                        "Slow session operation $functionName detected",
                                        [