mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 07:36:44 +02:00
Call credentials() from connect()
This commit is contained in:
@@ -41,7 +41,7 @@ if (!$error && $_POST) {
|
||||
if (!$result) {
|
||||
echo "<p class='error'>" . error() . "\n";
|
||||
} else {
|
||||
$connection2 = connect(adminer()->credentials());
|
||||
$connection2 = connect();
|
||||
if ($connection2) {
|
||||
$connection2->select_db(DB);
|
||||
}
|
||||
|
@@ -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);");
|
||||
|
@@ -55,7 +55,7 @@ if (!$error && $_POST) {
|
||||
$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"] != "") {
|
||||
|
Reference in New Issue
Block a user