]> git.joonet.de Git - adminer.git/commitdiff
Add back function to get driver name (fix #919)
authorJakub Vrana <jakub@vrana.cz>
Mon, 17 Mar 2025 07:07:24 +0000 (08:07 +0100)
committerJakub Vrana <jakub@vrana.cz>
Mon, 17 Mar 2025 07:07:24 +0000 (08:07 +0100)
This reverts fe88f83.

adminer/include/driver.inc.php
adminer/include/functions.inc.php
plugins/drivers/elastic.php
plugins/drivers/mongo.php

index 210f0998cba0b1421ac1bf8fe3c47fc01e583704..ae9289cf4670b5cc0ec7517e015090540f2f08b6 100644 (file)
@@ -13,12 +13,13 @@ function add_driver($id, $name) {
        $drivers[$id] = $name;
 }
 
-/** Get driver
-* @return Driver
+/** Get driver name
+* @param string
+* @return string
 */
-function get_driver() {
-       global $driver;
-       return $driver;
+function get_driver($id) {
+       global $drivers;
+       return $drivers[$id];
 }
 
 abstract class SqlDriver {
index 109c60cd41d5a6e584b84f30f64446de23890d3f..03ca625ba7fdb65e5dcbc299d253d75d7cdabe2c 100644 (file)
@@ -20,6 +20,14 @@ function adminer() {
        return $adminer;
 }
 
+/** Get Driver object
+* @return Driver
+*/
+function driver() {
+       global $driver;
+       return $driver;
+}
+
 /** Get Adminer version
 * @return string
 */
index 03a359d2890bfde367e107ccd04acaedbe0f506c..01922effea289a7ccc5a67002667af95de029cc4 100644 (file)
@@ -61,7 +61,7 @@ if (isset($_GET["elastic"])) {
                        function query($path, array $content = null, $method = 'GET') {
                                // Support for global search through all tables
                                if ($path != "" && $path[0] == "S" && preg_match('/SELECT 1 FROM ([^ ]+) WHERE (.+) LIMIT ([0-9]+)/', $path, $matches)) {
-                                       $driver = get_driver();
+                                       $driver = driver();
 
                                        $where = explode(" AND ", $matches[2]);
 
index ac7912fd872ef9f5cb9f97ecfacb2186cccdc417..f4a497bbfba335b244c436e96cb7516ff3d12051 100644 (file)
@@ -166,7 +166,7 @@ if (isset($_GET["mongo"])) {
                }
 
                function fields($table) {
-                       $driver = get_driver();
+                       $driver = driver();
                        $fields = fields_from_edit();
                        if (!$fields) {
                                $result = $driver->select($table, array("*"), null, null, array(), 10);