mirror of
https://github.com/vrana/adminer.git
synced 2025-08-09 08:06:59 +02:00
MongoDB: Display Authentication failed instead of exception
This commit is contained in:
@@ -13,7 +13,10 @@ if (isset($_GET["mongo"])) {
|
||||
|
||||
function connect($uri, $options) {
|
||||
$class = 'MongoDB\Driver\Manager';
|
||||
return new $class($uri, $options);
|
||||
$return = new $class($uri, $options);
|
||||
$class = 'MongoDB\Driver\Command';
|
||||
$return->executeCommand('admin', new $class(array('ping' => 1)));
|
||||
return $return;
|
||||
}
|
||||
|
||||
function query($query) {
|
||||
@@ -28,11 +31,6 @@ if (isset($_GET["mongo"])) {
|
||||
function quote($string) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
function ping($link) {
|
||||
$class = 'MongoDB\Driver\Command';
|
||||
$link->executeCommand('admin', new $class(array('ping' => 1)));
|
||||
}
|
||||
}
|
||||
|
||||
class Min_Result {
|
||||
@@ -397,9 +395,6 @@ if (isset($_GET["mongo"])) {
|
||||
function quote($string) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
function ping($link) {
|
||||
}
|
||||
}
|
||||
|
||||
class Min_Result {
|
||||
@@ -631,7 +626,7 @@ if (isset($_GET["mongo"])) {
|
||||
if ($password != "") {
|
||||
$options["password"] = "";
|
||||
try {
|
||||
$connection->ping($connection->connect("mongodb://$server", $options));
|
||||
$connection->connect("mongodb://$server", $options);
|
||||
return lang('Database does not support password.');
|
||||
} catch (Exception $ex) {
|
||||
// this is what we want
|
||||
|
Reference in New Issue
Block a user