Mongo.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <?php
  2. /*
  3. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. */
  15. /**
  16. * The connection point between MongoDB and PHP.
  17. * This class is used to initiate a connection and for database server commands.
  18. * @link http://www.php.net/manual/en/class.mongo.php
  19. * @deprecated This class has been DEPRECATED as of version 1.3.0.
  20. * Relying on this feature is highly discouraged. Please use MongoClient instead.
  21. * @see MongoClient
  22. */
  23. class Mongo extends MongoClient
  24. {
  25. /**
  26. * Dummy constructor to throw an exception
  27. */
  28. public function __construct()
  29. {
  30. $this->notImplemented();
  31. }
  32. /**
  33. * Get pool size for connection pools
  34. *
  35. * @link http://php.net/manual/en/mongo.getpoolsize.php
  36. * @return int Returns the current pool size.
  37. *
  38. * @deprecated This feature has been DEPRECATED as of version 1.2.3. Relying on this feature is highly discouraged. Please use MongoPool::getSize() instead.
  39. */
  40. public function getPoolSize()
  41. {
  42. $this->notImplemented();
  43. }
  44. /**
  45. * Returns the address being used by this for slaveOkay reads
  46. *
  47. * @link http://php.net/manual/en/mongo.getslave.php
  48. * @return bool The address of the secondary this connection is using for
  49. * reads. This returns NULL if this is not connected to a replica set or not yet
  50. * initialized.
  51. */
  52. public function getSlave()
  53. {
  54. $this->notImplemented();
  55. }
  56. /**
  57. * Get slaveOkay setting for this connection
  58. *
  59. * @link http://php.net/manual/en/mongo.getslaveokay.php
  60. * @return bool Returns the value of slaveOkay for this instance.
  61. */
  62. public function getSlaveOkay()
  63. {
  64. $this->notImplemented();
  65. }
  66. /**
  67. * Connects to paired database server
  68. *
  69. * @link http://www.php.net/manual/en/mongo.pairconnect.php
  70. * @throws MongoConnectionException
  71. * @return boolean
  72. *
  73. * @deprecated Pass a string of the form "mongodb://server1,server2" to the constructor instead of using this method.
  74. */
  75. public function pairConnect()
  76. {
  77. $this->notImplemented();
  78. }
  79. /**
  80. * Returns information about all connection pools.
  81. *
  82. * @link http://php.net/manual/en/mongo.pooldebug.php
  83. * @return array
  84. * @deprecated This feature has been DEPRECATED as of version 1.2.3. Relying on this feature is highly discouraged. Please use MongoPool::info() instead.
  85. */
  86. public function poolDebug()
  87. {
  88. $this->notImplemented();
  89. }
  90. /**
  91. * Change slaveOkay setting for this connection
  92. *
  93. * @link http://php.net/manual/en/mongo.setslaveokay.php
  94. * @param bool $ok
  95. * @return bool returns the former value of slaveOkay for this instance.
  96. */
  97. public function setSlaveOkay ($ok)
  98. {
  99. $this->notImplemented();
  100. }
  101. /**
  102. * Set the size for future connection pools.
  103. *
  104. * @link http://php.net/manual/en/mongo.setpoolsize.php
  105. * @param $size <p>The max number of connections future pools will be able to create. Negative numbers mean that the pool will spawn an infinite number of connections.</p>
  106. * @return bool Returns the former value of pool size.
  107. * @deprecated Relying on this feature is highly discouraged. Please use MongoPool::setSize() instead.
  108. */
  109. public function setPoolSize($size)
  110. {
  111. $this->notImplemented();
  112. }
  113. /**
  114. * Creates a persistent connection with a database server
  115. *
  116. * @link http://www.php.net/manual/en/mongo.persistconnect.php
  117. * @param string $username A username used to identify the connection.
  118. * @param string $password A password used to identify the connection.
  119. * @throws MongoConnectionException
  120. * @return boolean If the connection was successful.
  121. * @deprecated Pass array("persist" => $id) to the constructor instead of using this method.
  122. */
  123. public function persistConnect($username = "", $password = "")
  124. {
  125. $this->notImplemented();
  126. }
  127. /**
  128. * Creates a persistent connection with paired database servers
  129. *
  130. * @link http://www.php.net/manual/en/mongo.pairpersistconnect.php
  131. * @param string $username A username used to identify the connection.
  132. * @param string $password A password used to identify the connection.
  133. * @throws MongoConnectionException
  134. * @return boolean If the connection was successful.
  135. * @deprecated Pass "mongodb://server1,server2" and array("persist" => $id) to the constructor instead of using this method.
  136. */
  137. public function pairPersistConnect($username = "", $password = "")
  138. {
  139. $this->notImplemented();
  140. }
  141. /**
  142. * Connects with a database server
  143. *
  144. * @link http://www.php.net/manual/en/mongo.connectutil.php
  145. * @throws MongoConnectionException
  146. * @return boolean If the connection was successful.
  147. */
  148. protected function connectUtil()
  149. {
  150. $this->notImplemented();
  151. }
  152. /**
  153. * Check if there was an error on the most recent db operation performed
  154. *
  155. * @link http://www.php.net/manual/en/mongo.lasterror.php
  156. * @return array|null Returns the error, if there was one, or NULL.
  157. * @deprecated Use MongoDB::lastError() instead.
  158. */
  159. public function lastError()
  160. {
  161. $this->notImplemented();
  162. }
  163. /**
  164. * Checks for the last error thrown during a database operation
  165. *
  166. * @link http://www.php.net/manual/en/mongo.preverror.php
  167. * @return array Returns the error and the number of operations ago it occurred.
  168. * @deprecated Use MongoDB::prevError() instead.
  169. */
  170. public function prevError()
  171. {
  172. $this->notImplemented();
  173. }
  174. /**
  175. * Clears any flagged errors on the connection
  176. *
  177. * @link http://www.php.net/manual/en/mongo.reseterror.php
  178. * @return array Returns the database response.
  179. * @deprecated Use MongoDB::resetError() instead.
  180. */
  181. public function resetError()
  182. {
  183. $this->notImplemented();
  184. }
  185. /**
  186. * Creates a database error on the database.
  187. *
  188. * @link http://www.php.net/manual/en/mongo.forceerror.php
  189. * @return boolean The database response.
  190. * @deprecated Use MongoDB::forceError() instead.
  191. */
  192. public function forceError()
  193. {
  194. $this->notImplemented();
  195. }
  196. protected function notImplemented()
  197. {
  198. throw new \Exception('The Mongo class is deprecated and not supported through mongo-php-adapter');
  199. }
  200. }