fixing config value setting
This commit is contained in:
parent
9ec29f1e8e
commit
040504dca9
1 changed files with 12 additions and 6 deletions
|
@ -285,14 +285,20 @@ class Update
|
|||
|
||||
$savedConfig = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $key]);
|
||||
|
||||
if (DBA::isResult($savedConfig)) {
|
||||
$savedValue = $savedConfig['v'];
|
||||
} else {
|
||||
$savedValue = null;
|
||||
}
|
||||
|
||||
// If the db contains a config value, check it
|
||||
if (DBA::isResult($savedConfig) && $fileConfig !== $savedConfig['v']) {
|
||||
Logger::info('Difference in config found', ['cat' => $cat, 'key' => $key, 'file' => $fileConfig, 'saved' => $savedConfig['v']]);
|
||||
$configFileSaver->addConfigValue($cat, $key, $savedConfig['v']);
|
||||
if (isset($savedValue) && $fileConfig !== $savedValue) {
|
||||
Logger::info('Difference in config found', ['cat' => $cat, 'key' => $key, 'file' => $fileConfig, 'saved' => $savedValue]);
|
||||
$configFileSaver->addConfigValue($cat, $key, $savedValue);
|
||||
return true;
|
||||
|
||||
// If both config values are empty, use the default value
|
||||
} elseif (empty($fileConfig) && !DBA::isResult($savedConfig)) {
|
||||
// If both config values are not set, use the default value
|
||||
} elseif (!isset($fileConfig) && !isset($savedValue)) {
|
||||
Logger::info('Using default for config', ['cat' => $cat, 'key' => $key, 'value' => $default]);
|
||||
$configFileSaver->addConfigValue($cat, $key, $default);
|
||||
return true;
|
||||
|
@ -300,7 +306,7 @@ class Update
|
|||
// If either the file config value isn't empty or the db value is the same as the
|
||||
// file config value, skip it
|
||||
} else {
|
||||
Logger::info('No Difference in config found', ['cat' => $cat, 'key' => $key, 'value' => $fileConfig, 'saved' => $savedConfig['v']]);
|
||||
Logger::info('No Difference in config found', ['cat' => $cat, 'key' => $key, 'value' => $fileConfig, 'saved' => $savedValue]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue