]> git.joonet.de Git - adminer.git/commitdiff
Fix MongoDB connect 'Database does not support password.' tips
authorImDong <www@qs5.org>
Tue, 24 Nov 2020 12:34:48 +0000 (20:34 +0800)
committerJakub Vrana <jakub@vrana.cz>
Sun, 7 Feb 2021 12:08:29 +0000 (13:08 +0100)
Add MongoDB Drivers func ping.

adminer/drivers/mongo.inc.php
changes.txt

index 88c8e0dbc3f764682ecc103ef8c6c13f7e1ad832..57e6b7d5e3d04a020369b75562befc9b40277c9a 100644 (file)
@@ -31,6 +31,8 @@ if (isset($_GET["mongo"])) {
                                return $string;
                        }
 
+                       function ping($link) {
+                       }
                }
 
                class Min_Result {
@@ -221,6 +223,10 @@ if (isset($_GET["mongo"])) {
                                return $string;
                        }
 
+                       function ping($link) {
+                               $class = 'MongoDB\Driver\Command';
+                               $link->executeCommand('admin', new $class(array('ping' => 1)));
+                       }
                }
 
                class Min_Result {
@@ -626,7 +632,7 @@ if (isset($_GET["mongo"])) {
                        if ($password != "") {
                                $options["password"] = "";
                                try {
-                                       $connection->connect("mongodb://$server", $options);
+                                       $connection->ping($connection->connect("mongodb://$server", $options));
                                        return lang('Database does not support password.');
                                } catch (Exception $ex) {
                                        // this is what we want
index d4bc57043541191807f252dffef93ec9b77dde99..e02b19e59c8e6f6e4dc07168a205ad89510077fc 100644 (file)
@@ -17,6 +17,7 @@ PostgreSQL 10: Support partitioned tables (PR #396)
 PostgreSQL 11: Create PRIMARY KEY for auto increment columns
 SQLite: Set busy_timeout to 500
 MS SQL: Don't truncate comments to 30 chars (PR #376)
+MongoDB: Fix password-less check in the mongo extension (PR #405)
 Editor: Cast to string when searching (bug #325)
 Re-enable PHP warnings (regression from 4.7.8)