From 67dd2c21b6c2a2b1bde948015edd0f5a51569229 Mon Sep 17 00:00:00 2001 From: Ian Morland <16573496+imorland@users.noreply.github.com> Date: Tue, 22 Nov 2022 17:02:44 +0000 Subject: [PATCH] fix: provide web friendly session driver name (#3690) --- framework/core/src/Admin/Content/AdminPayload.php | 2 +- framework/core/src/Foundation/ApplicationInfoProvider.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/core/src/Admin/Content/AdminPayload.php b/framework/core/src/Admin/Content/AdminPayload.php index 4b45fc711..94d8ea6b6 100644 --- a/framework/core/src/Admin/Content/AdminPayload.php +++ b/framework/core/src/Admin/Content/AdminPayload.php @@ -113,7 +113,7 @@ class AdminPayload } $document->payload['queueDriver'] = $this->appInfo->identifyQueueDriver(); - $document->payload['sessionDriver'] = $this->appInfo->identifySessionDriver(); + $document->payload['sessionDriver'] = $this->appInfo->identifySessionDriver(true); /** * Used in the admin user list. Implemented as this as it matches the API in flarum/statistics. diff --git a/framework/core/src/Foundation/ApplicationInfoProvider.php b/framework/core/src/Foundation/ApplicationInfoProvider.php index e032540ae..794378de5 100644 --- a/framework/core/src/Foundation/ApplicationInfoProvider.php +++ b/framework/core/src/Foundation/ApplicationInfoProvider.php @@ -157,7 +157,7 @@ class ApplicationInfoProvider * 2. If the configured session driver is invalid, fallback to the default one and mention it. * 3. If the actual used driver (i.e `session.handler`) is different from the current one (configured or default), mention it. */ - public function identifySessionDriver(): string + public function identifySessionDriver(bool $forWeb = false): string { /* * Get the configured driver and fallback to the default one. @@ -190,11 +190,11 @@ class ApplicationInfoProvider $handlerName = str_replace('sessionhandler', '', $handlerName); if ($driver !== $handlerName) { - return "$handlerName (Code override. Configured to $configuredDriver)"; + return $forWeb ? $handlerName : "$handlerName (Code override. Configured to $configuredDriver)"; } if ($driver !== $configuredDriver) { - return "$driver (Fallback default driver. Configured to invalid driver $configuredDriver)"; + return $forWeb ? $driver : "$driver (Fallback default driver. Configured to invalid driver $configuredDriver)"; } return $driver;