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
|
|
|
/** |
17
|
|
|
* The connection point between MongoDB and PHP. |
18
|
|
|
* This class is used to initiate a connection and for database server commands. |
19
|
|
|
* @link http://www.php.net/manual/en/class.mongo.php |
20
|
|
|
* @deprecated This class has been DEPRECATED as of version 1.3.0. |
21
|
|
|
* Relying on this feature is highly discouraged. Please use MongoClient instead. |
22
|
|
|
* @see MongoClient |
23
|
|
|
*/ |
24
|
|
|
class Mongo extends MongoClient |
|
|
|
|
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* Dummy constructor to throw an exception |
28
|
|
|
*/ |
29
|
|
|
public function __construct() |
30
|
|
|
{ |
31
|
|
|
$this->notImplemented(); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Get pool size for connection pools |
36
|
|
|
* |
37
|
|
|
* @link http://php.net/manual/en/mongo.getpoolsize.php |
38
|
|
|
* @return int Returns the current pool size. |
39
|
|
|
* |
40
|
|
|
* @deprecated This feature has been DEPRECATED as of version 1.2.3. Relying on this feature is highly discouraged. Please use MongoPool::getSize() instead. |
41
|
|
|
*/ |
42
|
|
|
public function getPoolSize() |
43
|
|
|
{ |
44
|
|
|
$this->notImplemented(); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Returns the address being used by this for slaveOkay reads |
49
|
|
|
* |
50
|
|
|
* @link http://php.net/manual/en/mongo.getslave.php |
51
|
|
|
* @return bool The address of the secondary this connection is using for |
52
|
|
|
* reads. This returns NULL if this is not connected to a replica set or not yet |
53
|
|
|
* initialized. |
54
|
|
|
*/ |
55
|
|
|
public function getSlave() |
56
|
|
|
{ |
57
|
|
|
$this->notImplemented(); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Get slaveOkay setting for this connection |
62
|
|
|
* |
63
|
|
|
* @link http://php.net/manual/en/mongo.getslaveokay.php |
64
|
|
|
* @return bool Returns the value of slaveOkay for this instance. |
65
|
|
|
*/ |
66
|
|
|
public function getSlaveOkay() |
67
|
|
|
{ |
68
|
|
|
$this->notImplemented(); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Connects to paired database server |
73
|
|
|
* |
74
|
|
|
* @link http://www.php.net/manual/en/mongo.pairconnect.php |
75
|
|
|
* @throws MongoConnectionException |
76
|
|
|
* @return boolean |
77
|
|
|
* |
78
|
|
|
* @deprecated Pass a string of the form "mongodb://server1,server2" to the constructor instead of using this method. |
79
|
|
|
*/ |
80
|
|
|
public function pairConnect() |
81
|
|
|
{ |
82
|
|
|
$this->notImplemented(); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Returns information about all connection pools. |
87
|
|
|
* |
88
|
|
|
* @link http://php.net/manual/en/mongo.pooldebug.php |
89
|
|
|
* @return array |
90
|
|
|
* @deprecated This feature has been DEPRECATED as of version 1.2.3. Relying on this feature is highly discouraged. Please use MongoPool::info() instead. |
91
|
|
|
*/ |
92
|
|
|
public function poolDebug() |
93
|
|
|
{ |
94
|
|
|
$this->notImplemented(); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Change slaveOkay setting for this connection |
99
|
|
|
* |
100
|
|
|
* @link http://php.net/manual/en/mongo.setslaveokay.php |
101
|
|
|
* @param bool $ok |
102
|
|
|
* @return bool returns the former value of slaveOkay for this instance. |
103
|
|
|
*/ |
104
|
|
|
public function setSlaveOkay ($ok) |
|
|
|
|
105
|
|
|
{ |
106
|
|
|
$this->notImplemented(); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Set the size for future connection pools. |
111
|
|
|
* |
112
|
|
|
* @link http://php.net/manual/en/mongo.setpoolsize.php |
113
|
|
|
* @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> |
114
|
|
|
* @return bool Returns the former value of pool size. |
115
|
|
|
* @deprecated Relying on this feature is highly discouraged. Please use MongoPool::setSize() instead. |
116
|
|
|
*/ |
117
|
|
|
public function setPoolSize($size) |
|
|
|
|
118
|
|
|
{ |
119
|
|
|
$this->notImplemented(); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Creates a persistent connection with a database server |
124
|
|
|
* |
125
|
|
|
* @link http://www.php.net/manual/en/mongo.persistconnect.php |
126
|
|
|
* @param string $username A username used to identify the connection. |
127
|
|
|
* @param string $password A password used to identify the connection. |
128
|
|
|
* @throws MongoConnectionException |
129
|
|
|
* @return boolean If the connection was successful. |
130
|
|
|
* @deprecated Pass array("persist" => $id) to the constructor instead of using this method. |
131
|
|
|
*/ |
132
|
|
|
public function persistConnect($username = "", $password = "") |
|
|
|
|
133
|
|
|
{ |
134
|
|
|
$this->notImplemented(); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Creates a persistent connection with paired database servers |
139
|
|
|
* |
140
|
|
|
* @link http://www.php.net/manual/en/mongo.pairpersistconnect.php |
141
|
|
|
* @param string $username A username used to identify the connection. |
142
|
|
|
* @param string $password A password used to identify the connection. |
143
|
|
|
* @throws MongoConnectionException |
144
|
|
|
* @return boolean If the connection was successful. |
145
|
|
|
* @deprecated Pass "mongodb://server1,server2" and array("persist" => $id) to the constructor instead of using this method. |
146
|
|
|
*/ |
147
|
|
|
public function pairPersistConnect($username = "", $password = "") |
|
|
|
|
148
|
|
|
{ |
149
|
|
|
$this->notImplemented(); |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* Connects with a database server |
154
|
|
|
* |
155
|
|
|
* @link http://www.php.net/manual/en/mongo.connectutil.php |
156
|
|
|
* @throws MongoConnectionException |
157
|
|
|
* @return boolean If the connection was successful. |
158
|
|
|
*/ |
159
|
|
|
protected function connectUtil() |
160
|
|
|
{ |
161
|
|
|
$this->notImplemented(); |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Check if there was an error on the most recent db operation performed |
166
|
|
|
* |
167
|
|
|
* @link http://www.php.net/manual/en/mongo.lasterror.php |
168
|
|
|
* @return array|null Returns the error, if there was one, or NULL. |
169
|
|
|
* @deprecated Use MongoDB::lastError() instead. |
170
|
|
|
*/ |
171
|
|
|
public function lastError() |
172
|
|
|
{ |
173
|
|
|
$this->notImplemented(); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Checks for the last error thrown during a database operation |
178
|
|
|
* |
179
|
|
|
* @link http://www.php.net/manual/en/mongo.preverror.php |
180
|
|
|
* @return array Returns the error and the number of operations ago it occurred. |
181
|
|
|
* @deprecated Use MongoDB::prevError() instead. |
182
|
|
|
*/ |
183
|
|
|
public function prevError() |
184
|
|
|
{ |
185
|
|
|
$this->notImplemented(); |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* Clears any flagged errors on the connection |
190
|
|
|
* |
191
|
|
|
* @link http://www.php.net/manual/en/mongo.reseterror.php |
192
|
|
|
* @return array Returns the database response. |
193
|
|
|
* @deprecated Use MongoDB::resetError() instead. |
194
|
|
|
*/ |
195
|
|
|
public function resetError() |
196
|
|
|
{ |
197
|
|
|
$this->notImplemented(); |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* Creates a database error on the database. |
202
|
|
|
* |
203
|
|
|
* @link http://www.php.net/manual/en/mongo.forceerror.php |
204
|
|
|
* @return boolean The database response. |
205
|
|
|
* @deprecated Use MongoDB::forceError() instead. |
206
|
|
|
*/ |
207
|
|
|
public function forceError() |
208
|
|
|
{ |
209
|
|
|
$this->notImplemented(); |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
protected function notImplemented() |
213
|
|
|
{ |
214
|
|
|
throw new \Exception('The Mongo class is deprecated and not supported through mongo-php-adapter'); |
215
|
|
|
} |
216
|
|
|
} |
217
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.