straight the config value check
This commit is contained in:
parent
7d88b800b8
commit
9ec29f1e8e
1 changed files with 10 additions and 8 deletions
|
@ -285,22 +285,24 @@ class Update
|
||||||
|
|
||||||
$savedConfig = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $key]);
|
$savedConfig = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $key]);
|
||||||
|
|
||||||
if (!DBA::isResult($savedConfig)) {
|
// If the db contains a config value, check it
|
||||||
$savedConfig = null;
|
if (DBA::isResult($savedConfig) && $fileConfig !== $savedConfig['v']) {
|
||||||
}
|
|
||||||
|
|
||||||
if ($fileConfig !== $savedConfig['v']) {
|
|
||||||
Logger::info('Difference in config found', ['cat' => $cat, 'key' => $key, 'file' => $fileConfig, 'saved' => $savedConfig['v']]);
|
Logger::info('Difference in config found', ['cat' => $cat, 'key' => $key, 'file' => $fileConfig, 'saved' => $savedConfig['v']]);
|
||||||
$configFileSaver->addConfigValue($cat, $key, $savedConfig['v']);
|
$configFileSaver->addConfigValue($cat, $key, $savedConfig['v']);
|
||||||
} elseif (empty($fileConfig) && empty($savedConfig)) {
|
return true;
|
||||||
|
|
||||||
|
// If both config values are empty, use the default value
|
||||||
|
} elseif (empty($fileConfig) && !DBA::isResult($savedConfig)) {
|
||||||
Logger::info('Using default for config', ['cat' => $cat, 'key' => $key, 'value' => $default]);
|
Logger::info('Using default for config', ['cat' => $cat, 'key' => $key, 'value' => $default]);
|
||||||
$configFileSaver->addConfigValue($cat, $key, $default);
|
$configFileSaver->addConfigValue($cat, $key, $default);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// If either the file config value isn't empty or the db value is the same as the
|
||||||
|
// file config value, skip it
|
||||||
} else {
|
} 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' => $savedConfig['v']]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue