#8899 Fixed history_db_enabled 2

This commit is contained in:
Daniel Maya 2022-06-16 08:44:09 +02:00
parent 9a7e0e3228
commit bb01bfe2d0
2 changed files with 10 additions and 14 deletions

View File

@ -1624,44 +1624,40 @@ function config_update_config()
if ($dbm->check() === true) { if ($dbm->check() === true) {
// Historical configuration tokens (stored in historical db). // Historical configuration tokens (stored in historical db).
if (Config::set( if ($dbm->setConfigToken(
'days_purge', 'days_purge',
get_parameter('history_dbh_purge'), get_parameter('history_dbh_purge')
true
) !== true ) !== true
) { ) {
$error_update[] = __('Historical database purge'); $error_update[] = __('Historical database purge');
} }
if (Config::set( if ($dbm->setConfigToken(
'history_partitions_auto', 'history_partitions_auto',
get_parameter_switch('history_partitions_auto', 0), get_parameter_switch('history_partitions_auto', 0)
true
) !== true ) !== true
) { ) {
$error_update[] = __('Historical database partitions'); $error_update[] = __('Historical database partitions');
} }
if (Config::set( if ($dbm->setConfigToken(
'event_purge', 'event_purge',
get_parameter('history_dbh_events_purge'), get_parameter('history_dbh_events_purge')
true
) !== true ) !== true
) { ) {
$error_update[] = __('Historical database events purge'); $error_update[] = __('Historical database events purge');
} }
if (Config::set( if ($dbm->setConfigToken(
'string_purge', 'string_purge',
get_parameter('history_dbh_string_purge'), get_parameter('history_dbh_string_purge')
true
) !== true ) !== true
) { ) {
$error_update[] = __('Historical database string purge'); $error_update[] = __('Historical database string purge');
} }
// Disable history db in history db. // Disable history db in history db.
Config::set('history_db_enabled', 0, true); $dbm->setConfigToken('history_db_enabled', 0);
} }
} }
break; break;

View File

@ -384,7 +384,7 @@ final class DBMaintainer
* *
* @return boolean Success or not. * @return boolean Success or not.
*/ */
private function setConfigToken(string $token, $value) public function setConfigToken(string $token, $value)
{ {
$prev = $this->getValue('tconfig', 'value', ['token' => $token]); $prev = $this->getValue('tconfig', 'value', ['token' => $token]);
// If failed or not found, then insert. // If failed or not found, then insert.