aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2024-08-27 18:10:16 -0100
committerGitHub <noreply@github.com>2024-08-27 18:10:16 -0100
commite68f77ea6c28e05f65c1a519d2131c76df10dfe9 (patch)
treedca689552d517349925c9f8cda52b1a72e243cc1
parent95fff6bc72f1f05050d87ef5f7bfb7ce5c5214af (diff)
parent9100b8757e3cf9b5588ae58728e17fee6a38ced6 (diff)
downloadnextcloud-server-e68f77ea6c28e05f65c1a519d2131c76df10dfe9.tar.gz
nextcloud-server-e68f77ea6c28e05f65c1a519d2131c76df10dfe9.zip
Merge pull request #47521 from nextcloud/fix/noid/loosing-systemconfig-on-setup
fix(logger): ignore session logging during setup
-rw-r--r--lib/base.php7
-rw-r--r--lib/private/Session/Internal.php8
2 files changed, 11 insertions, 4 deletions
diff --git a/lib/base.php b/lib/base.php
index 6491c191d25..d0d030faf55 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -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);
diff --git a/lib/private/Session/Internal.php b/lib/private/Session/Internal.php
index 5398dc710af..b465bcd3eda 100644
--- a/lib/private/Session/Internal.php
+++ b/lib/private/Session/Internal.php
@@ -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",
[