fixed history timeout pandora_enterprise#9273

This commit is contained in:
Daniel Barbero Martin 2022-07-27 14:28:50 +02:00
parent 95d369cca0
commit 770933a2dd
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;
}
}
}
/**