if (!$result) {
echo "<p class='error'>" . error() . "\n";
} else {
- $connection2 = connect(adminer()->credentials());
+ $connection2 = connect();
if ($connection2) {
$connection2->select_db(DB);
}
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);
}
$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);");
$delimiter = ";";
$offset = 0;
$empty = true;
- $connection2 = connect(adminer()->credentials()); // connection for exploring indexes and EXPLAIN (to not replace FOUND_ROWS()) //! PDO - silent error
+ $connection2 = connect(); // connection for exploring indexes and EXPLAIN (to not replace FOUND_ROWS()) //! PDO - silent error
if ($connection2 && DB != "") {
$connection2->select_db(DB);
if ($_GET["ns"] != "") {