From 5d28b5a9fa670bda05767d2c8ed4d22381ecc220 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 24 Jan 2025 11:29:10 +0100 Subject: [PATCH] Changed Logger Format, SQL connect bugfix --- Core/Driver/Logger/Logger.class.php | 2 +- Core/Objects/Context.class.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Core/Driver/Logger/Logger.class.php b/Core/Driver/Logger/Logger.class.php index ce4035a..3241da8 100644 --- a/Core/Driver/Logger/Logger.class.php +++ b/Core/Driver/Logger/Logger.class.php @@ -92,7 +92,7 @@ class Logger { // database logging failed, try to log to file $module = preg_replace("/[^a-zA-Z0-9-]/", "-", $this->module); $date = (\DateTime::createFromFormat('U.u', microtime(true)))->format(self::LOG_FILE_DATE_FORMAT); - $logFile = implode("_", [$module, $severity, $date]) . ".log"; + $logFile = implode("_", [$date, $module, $severity]) . ".log"; $logPath = implode(DIRECTORY_SEPARATOR, [WEBROOT, "Site", "Logs", $logFile]); @file_put_contents($logPath, $message); } diff --git a/Core/Objects/Context.class.php b/Core/Objects/Context.class.php index 3f84a6a..456672d 100644 --- a/Core/Objects/Context.class.php +++ b/Core/Objects/Context.class.php @@ -89,13 +89,12 @@ class Context { if ($this->sql->isConnected()) { $settings = $this->configuration->getSettings(); $settings->loadFromDatabase($this); - return $this->sql; } } else { $this->sql = null; } - return null; + return $this->sql; } public function getSQL(): ?SQL {