Merge branch 'ent-8899-13499-problema-con-conexion-db-hist-con-contrasenas-con-caracteres-especiales' into 'develop'

Ent 8899 13499 problema con conexion db hist con contrasenas con caracteres especiales

See merge request artica/pandorafms!4852
This commit is contained in:
Daniel Rodriguez 2022-06-16 09:03:28 +00:00
commit 52cfd6b70a
2 changed files with 41 additions and 42 deletions

View File

@ -1607,7 +1607,7 @@ function config_update_config()
'port' => $config['history_db_port'], 'port' => $config['history_db_port'],
'name' => $config['history_db_name'], 'name' => $config['history_db_name'],
'user' => $config['history_db_user'], 'user' => $config['history_db_user'],
'pass' => $config['history_db_pass'], 'pass' => io_output_password($config['history_db_pass']),
] ]
); );
@ -1619,48 +1619,47 @@ function config_update_config()
$dbm->process(); $dbm->process();
} else if ($dbm->check() !== true) { } else if ($dbm->check() !== true) {
$errors[] = $dbm->getLastError(); $errors[] = $dbm->getLastError();
} config_update_value('history_db_enabled', false);
} }
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;
case 'ehorus': case 'ehorus':

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.