Merge branch 'ent-9273-comprobacion-base-de-datos-de-historico-del-setup-provoca-error-504' into 'develop'

fixed history timeout pandora_enterprise#9273

See merge request artica/pandorafms!5034
This commit is contained in:
Daniel Rodriguez 2022-07-29 08:38:12 +00:00
commit 9751167f56
2 changed files with 72 additions and 39 deletions

View File

@ -64,6 +64,21 @@ final class Config
|| $config['history_db_connection'] === false
) {
ob_start();
$link = mysqli_init();
$link->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2);
$rc = mysqli_real_connect(
$link,
$$config['history_db_host'],
$config['history_db_user'],
io_output_password($config['history_db_pass']),
$config['history_db_name'],
$config['history_db_port']
);
if ($rc === false) {
$config['history_db_connection'] = false;
} else {
$config['history_db_connection'] = db_connect(
$config['history_db_host'],
$config['history_db_name'],
@ -72,9 +87,9 @@ final class Config
$config['history_db_port'],
false
);
}
ob_get_clean();
}
if ($config['history_db_connection'] !== false) {
$data = \db_get_all_rows_sql(
@ -98,6 +113,7 @@ final class Config
[]
);
}
}
/**

View File

@ -156,6 +156,22 @@ final class DBMaintainer
return true;
}
$link = mysqli_init();
$link->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2);
$rc = mysqli_real_connect(
$link,
$this->host,
$this->user,
$this->pass,
null,
$this->port
);
if ($rc === false) {
$this->dbh = null;
$this->connected = false;
$this->lastError = __('Connection problems');
} else {
$dbc = new \mysqli(
$this->host,
$this->user,
@ -185,6 +201,7 @@ final class DBMaintainer
$this->connected = true;
}
}
}
/**