diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index c934a7aea7..635ca25767 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1619,48 +1619,51 @@ function config_update_config() $dbm->process(); } else if ($dbm->check() !== true) { $errors[] = $dbm->getLastError(); + config_update_value('history_db_enabled', false); + } + + if ($dbm->check() === true) { + // Historical configuration tokens (stored in historical db). + if (Config::set( + 'days_purge', + get_parameter('history_dbh_purge'), + true + ) !== true + ) { + $error_update[] = __('Historical database purge'); + } + + if (Config::set( + 'history_partitions_auto', + get_parameter_switch('history_partitions_auto', 0), + true + ) !== true + ) { + $error_update[] = __('Historical database partitions'); + } + + if (Config::set( + 'event_purge', + get_parameter('history_dbh_events_purge'), + true + ) !== true + ) { + $error_update[] = __('Historical database events purge'); + } + + if (Config::set( + 'string_purge', + get_parameter('history_dbh_string_purge'), + true + ) !== true + ) { + $error_update[] = __('Historical database string purge'); + } + + // Disable history db in history db. + Config::set('history_db_enabled', 0, true); } } - - // Historical configuration tokens (stored in historical db). - if (Config::set( - 'days_purge', - get_parameter('history_dbh_purge'), - true - ) !== true - ) { - $error_update[] = __('Historical database purge'); - } - - if (Config::set( - 'history_partitions_auto', - get_parameter_switch('history_partitions_auto', 0), - true - ) !== true - ) { - $error_update[] = __('Historical database partitions'); - } - - if (Config::set( - 'event_purge', - get_parameter('history_dbh_events_purge'), - true - ) !== true - ) { - $error_update[] = __('Historical database events purge'); - } - - if (Config::set( - 'string_purge', - get_parameter('history_dbh_string_purge'), - true - ) !== true - ) { - $error_update[] = __('Historical database string purge'); - } - - // Disable history db in history db. - Config::set('history_db_enabled', 0, true); break; case 'ehorus':