Просмотр исходного кода

Throw appropriate exception in authenticate()

Andreas Braun 10 лет назад
Родитель
Сommit
d26402e017
2 измененных файлов с 6 добавлено и 3 удалено
  1. 3 2
      README.md
  2. 3 1
      lib/Mongo/MongoDB.php

+ 3 - 2
README.md

@@ -52,6 +52,9 @@ root:
  method is not yet implemented.
 
 ## MongoDB
+ - The [MongoDB::authenticate](https://secure.php.net/manual/de/mongodb.authenticate.php)
+ method is not supported. To connect to a database with authentication, please
+ supply the credentials using the connection string.
  - The `includeSystemCollections` parameter used in the [MongoDB::getCollectionInfo](https://php.net/manual/de/mongodb.getcollectioninfo.php]),
  [MongoDB::getCollectionNames](https://php.net/manual/de/mongodb.getcollectionnames.php]),
  and [MongoDB::listCollections](https://php.net/manual/de/mongodb.listcollections.php)
@@ -59,8 +62,6 @@ root:
  collections.
  - The [MongoDB::repair](https://secure.php.net/manual/de/mongodb.repair.php)
  method is not yet implemented.
- - The [MongoDB::authenticate](https://secure.php.net/manual/de/mongodb.authenticate.php)
- method is not yet implemented.
 
 ## MongoCollection
 

+ 3 - 1
lib/Mongo/MongoDB.php

@@ -426,10 +426,12 @@ class MongoDB
      * @param string $username The username.
      * @param string $password The password (in plaintext).
      * @return array Returns database response. If the login was successful, it will return 1.
+     *
+     * @deprecated This method is not implemented, supply authentication credentials through the connection string instead.
      */
     public function authenticate($username, $password)
     {
-        $this->notImplemented();
+        throw new \Exception('The MongoDB::authenticate method is not supported. Please supply authentication credentials through the connection string');
     }
 
     /**