]> git.joonet.de Git - adminer.git/commitdiff
Call credentials() from connect()
authorJakub Vrana <jakub@vrana.cz>
Thu, 3 Apr 2025 08:23:31 +0000 (10:23 +0200)
committerJakub Vrana <jakub@vrana.cz>
Thu, 3 Apr 2025 08:23:31 +0000 (10:23 +0200)
adminer/call.inc.php
adminer/include/functions.inc.php
adminer/sql.inc.php

index aae0012a328f55173f1fb6440e52f1495770124a..404ec52adaad9e3117814b4647bb48d80a09fcbd 100644 (file)
@@ -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);
                }
index a2882a6e24fb134baad0a12aa4797e386ab9344e..1a945c388e5fe0c6877096e3fbb4127050545694 100644 (file)
@@ -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);");
index 790aff0c7f3214729e5aac7e8fdde7f122e37a69..f0833d7fbd43dd6eb4d5c188d8c2a7c3cb34f629 100644 (file)
@@ -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"] != "") {