allow to store configuration in database

This commit is contained in:
Roland Gruber 2021-04-04 10:20:03 +02:00
parent bf6bbe5e7a
commit d6fd49a232
2 changed files with 6 additions and 2 deletions

View file

@ -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;

View file

@ -263,6 +263,7 @@ function logNewMessage($level, $message) {
}
else {
$cfg = new LAMCfgMain();
$_SESSION['cfgMain'] = $cfg;
}
// check if logging is disabled
if (($cfg->logDestination == 'NONE')