Skip to content

Commit

Permalink
fix(setup): ignore long session login during installation
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
  • Loading branch information
ArtificialOwl authored and backportbot[bot] committed Aug 27, 2024
1 parent 6c73b11 commit 135b270
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 6 additions & 1 deletion lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,15 @@ public static function initSession(): void {
$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);
Expand Down
8 changes: 5 additions & 3 deletions lib/private/Session/Internal.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,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', ['']);
Expand Down Expand Up @@ -228,7 +230,7 @@ private function invoke(string $functionName, array $parameters = [], bool $sile
$timeSpent > 0.5 => ILogger::INFO,
default => ILogger::DEBUG,
};
$this->logger->log(
$this->logger?->log(
$logLevel,
"Slow session operation $functionName detected",
[
Expand Down

0 comments on commit 135b270

Please sign in to comment.