mirror of
https://github.com/vrana/adminer.git
synced 2025-08-07 23:27:17 +02:00
Call credentials() from connect()
This commit is contained in:
@@ -24,10 +24,9 @@ function driver(): Driver {
|
||||
return Driver::$instance;
|
||||
}
|
||||
|
||||
/** Connect to the database
|
||||
* @param array{?string, string, string} $credentials [$server, $username, $password]
|
||||
*/
|
||||
function connect(array $credentials): ?Db {
|
||||
/** Connect to the database */
|
||||
function connect(): ?Db {
|
||||
$credentials = adminer()->credentials();
|
||||
$return = Driver::connect($credentials[0], $credentials[1], $credentials[2]);
|
||||
return (is_object($return) ? $return : null);
|
||||
}
|
||||
@@ -831,7 +830,7 @@ function slow_query(string $query): array {
|
||||
$slow_query = driver()->slowQuery($query, $timeout);
|
||||
$connection2 = null;
|
||||
if (!$slow_query && support("kill")) {
|
||||
$connection2 = connect(adminer()->credentials());
|
||||
$connection2 = connect();
|
||||
if ($connection2 && ($db == "" || $connection2->select_db($db))) {
|
||||
$kill = get_val(connection_id(), 0, $connection2); // MySQL and MySQLi can use thread_id but it's not in PDO_MySQL
|
||||
echo script("const timeout = setTimeout(() => { ajax('" . js_escape(ME) . "script=kill', function () {}, 'kill=$kill&token=" . get_token() . "'); }, 1000 * $timeout);");
|
||||
|
Reference in New Issue
Block a user