From d6fd49a232fb1a362420054c0df27afbaf3dcc23 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 4 Apr 2021 10:20:03 +0200 Subject: [PATCH] allow to store configuration in database --- lam/lib/config.inc | 7 +++++-- lam/lib/security.inc | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lam/lib/config.inc b/lam/lib/config.inc index f6e6840d9..3b75d0e60 100644 --- a/lam/lib/config.inc +++ b/lam/lib/config.inc @@ -3099,6 +3099,9 @@ class LAMCfgMain { return false; } $data = $result->fetchAll(); + if (empty($data)) { + return true; + } $jsonData = json_decode($data[0]['value'], true); foreach ($this->persistenceSettings as $persistenceSetting) { if (isset($jsonData[$persistenceSetting])) { @@ -3108,11 +3111,11 @@ class LAMCfgMain { $this->importData($jsonData); } catch (PDOException $e) { - logNewMessage(LOG_ERR, 'Unable to read main config: ' . $e->getMessage()); + syslog(LOG_ERR, 'Unable to read main config: ' . $e->getMessage()); return false; } catch (LAMException $e) { - logNewMessage(LOG_ERR, 'Unable to import main config: ' . $e->getMessage()); + syslog(LOG_ERR, 'Unable to import main config: ' . $e->getMessage()); return false; } return true; diff --git a/lam/lib/security.inc b/lam/lib/security.inc index 9c3d3d41c..5cd4cac03 100644 --- a/lam/lib/security.inc +++ b/lam/lib/security.inc @@ -263,6 +263,7 @@ function logNewMessage($level, $message) { } else { $cfg = new LAMCfgMain(); + $_SESSION['cfgMain'] = $cfg; } // check if logging is disabled if (($cfg->logDestination == 'NONE')