#12522 fixed multiple audit when update setup

This commit is contained in:
Daniel Cebrian 2024-01-24 09:15:32 +01:00
parent 0ceb578717
commit 4fc3013cc3
1 changed files with 14 additions and 7 deletions

View File

@ -104,6 +104,7 @@ function config_update_value($token, $value, $noticed=false, $password=false)
return true;
}
$prev_value = $config[$token];
$config[$token] = $value;
$value = io_safe_output($value);
@ -117,13 +118,24 @@ function config_update_value($token, $value, $noticed=false, $password=false)
return true;
} else {
// Something in setup changes.
if ($noticed === true) {
$value_token = (empty($config[$token]) === true) ? 0 : $config[$token];
$prev_value = (empty($prev_value) === true) ? 0 : $prev_value;
if (is_array($prev_value) === true) {
$prev_value = implode(';', $prev_value);
}
if ($noticed === true && $prev_value !== $value_token) {
db_pandora_audit(
AUDIT_LOG_SETUP,
'Setup has changed',
false,
false,
sprintf('Token << %s >> updated.', $token)
sprintf(
'Token << %s >> updated %s -> %s',
$token,
$prev_value,
$value_token
)
);
}
@ -2090,11 +2102,6 @@ function config_update_config()
} else {
$config['error_config_update_config'] = [];
$config['error_config_update_config']['correct'] = true;
db_pandora_audit(
AUDIT_LOG_SETUP,
'Setup has changed'
);
}
if (count($errors) > 0) {