svn: /phpdoc/en/trunk/reference/mongo/mongo/ close.xml connectutil.xml construct.xml gethosts.xml setpoolsize.xml
| From: | Derick Rethans | Date: | Wed, 07 Nov 2012 15:59:17 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/mongo/mongo/ close.xml connectutil.xml construct.xml gethosts.xml setpoolsize.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-10667@lists.php.net to get a copy of this message | ||
derick Wed, 07 Nov 2012 15:59:17 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=328271
Log:
Fixed PHP-562: Document changes to Mongo::close().
Added a warning Mongo::connectUtil to show it is deprecated.
Add see-also's.
Changed paths:
U phpdoc/en/trunk/reference/mongo/mongo/close.xml
U phpdoc/en/trunk/reference/mongo/mongo/connectutil.xml
U phpdoc/en/trunk/reference/mongo/mongo/construct.xml
U phpdoc/en/trunk/reference/mongo/mongo/gethosts.xml
U phpdoc/en/trunk/reference/mongo/mongo/setpoolsize.xml
Modified: phpdoc/en/trunk/reference/mongo/mongo/close.xml
===================================================================
--- phpdoc/en/trunk/reference/mongo/mongo/close.xml 2012-11-07 15:51:05 UTC (rev 328270)
+++ phpdoc/en/trunk/reference/mongo/mongo/close.xml 2012-11-07 15:59:17 UTC (rev 328271)
@@ -11,22 +11,49 @@
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier>
<type>bool</type><methodname>Mongo::close</methodname>
- <void/>
+ <methodparam
choice="opt"><type>boolean|string</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
- The <methodname>Mongo::close</methodname> method forcefully closes a connection to
the
+ The <function>Mongo::close</function> method forcefully closes a connection to the
database, even if persistent connections are being used. You do under
normal circumstance <emphasis>never</emphasis> have to do this.
</para>
<para>
- If you are connected to a replica set, close() will only close the connection
- to the primary.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
- &no.function.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term>
+ <parameter>connection</parameter>
+ </term>
+ <listitem>
+ <para>
+ If connection is not given, or &false; then connection that would be
+ selected for writes would be closed. In a single-node configuration,
+ that is then the whole connection, but if you are connected to a
+ replica set, close() will <emphasis>only</emphasis> close the
+ connection to the primary server.
+ </para>
+ <para>
+ If connection is &true; then all connections as known by the connection
+ manager will be closed. This can include connections that are not
+ referenced to in the connection string used to create the object that
+ you are calling close on.
+ </para>
+ <para>
+ If connection is a string argument, then it will only close the
+ connection identified by this hash. Hashes are identifiers for a
+ connection and can be obtained by calling
+ <function>Mongo::getConnections</function>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
</refsect1>
<refsect1 role="returnvalues">
@@ -36,6 +63,43 @@
</para>
</refsect1>
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <example>
+ <title><function>MongoCollection::close</function> example</title>
+ <para>This example demonstrates how to selectively close all connections
+ for secondaries only.</para>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// Connect to a replicaset
+$a = new Mongo("mongodb://whisky:13000/?replicaset=seta");
+
+$connections = $a->getConnections();
+
+foreach ( $connections as $con )
+{
+ // Loop over all the connections, and when the type is "SECONDARY"
+ // we close the connection
+ if ( $con['connection']['connection_type_desc'] == "SECONDARY" )
+ {
+ echo "Closing '{$con['hash']}': ";
+ $closed = $a->close( $con['hash'] );
+ echo $closed ? "ok" : "failed", "\n";
+ }
+}
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+Closing 'whisky:13001;X;4948': ok
+]]>
+ </screen>
+ </example>
+ </refsect1>
+
<refsect1 role="changelog">
&reftitle.changelog;
<para>
@@ -49,6 +113,16 @@
</thead>
<tbody>
<row>
+ <entry>1.3.0</entry>
+ <entry>
+ <para>
+ The <parameter>connection</parameter> parameter to this function was
+ added in 1.3.0. Before that, only the write connection would be
+ closed by this method.
+ </para>
+ </entry>
+ </row>
+ <row>
<entry>1.2.0</entry>
<entry>
<para>
@@ -65,6 +139,13 @@
</informaltable>
</para>
</refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <simplelist>
+ <member><function>Mongo::getConnections</function></member>
+ </simplelist>
+ </refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
Modified: phpdoc/en/trunk/reference/mongo/mongo/connectutil.xml
===================================================================
--- phpdoc/en/trunk/reference/mongo/mongo/connectutil.xml 2012-11-07 15:51:05 UTC (rev 328270)
+++ phpdoc/en/trunk/reference/mongo/mongo/connectutil.xml 2012-11-07 15:59:17 UTC (rev 328271)
@@ -13,6 +13,12 @@
<modifier>protected</modifier>
<type>bool</type><methodname>Mongo::connectUtil</methodname>
<void/>
</methodsynopsis>
+ <warning>
+ <para>
+ This is an internal function that you should <emphasis>never</emphasis>
+ call yourself.
+ </para>
+ </warning>
</refsect1>
<refsect1 role="parameters">
Modified: phpdoc/en/trunk/reference/mongo/mongo/construct.xml
===================================================================
--- phpdoc/en/trunk/reference/mongo/mongo/construct.xml 2012-11-07 15:51:05 UTC (rev 328270)
+++ phpdoc/en/trunk/reference/mongo/mongo/construct.xml 2012-11-07 15:59:17 UTC (rev 328271)
@@ -94,7 +94,7 @@
&true;. When set to &false; the driver will
<emphasis>automatically</emphasis> connection to the server whenever
it is necessary to do a query. Alternatively, you can run
- <methodname>Mongo::connect</methodname> manually.
+ <function>Mongo::connect</function> manually.
</para>
<warning>
<para>
Modified: phpdoc/en/trunk/reference/mongo/mongo/gethosts.xml
===================================================================
--- phpdoc/en/trunk/reference/mongo/mongo/gethosts.xml 2012-11-07 15:51:05 UTC (rev 328270)
+++ phpdoc/en/trunk/reference/mongo/mongo/gethosts.xml 2012-11-07 15:59:17 UTC (rev 328271)
@@ -128,6 +128,13 @@
</informaltable>
</para>
</refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <simplelist>
+ <member><function>Mongo::getConnections</function></member>
+ </simplelist>
+ </refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
Modified: phpdoc/en/trunk/reference/mongo/mongo/setpoolsize.xml
===================================================================
--- phpdoc/en/trunk/reference/mongo/mongo/setpoolsize.xml 2012-11-07 15:51:05 UTC (rev 328270)
+++ phpdoc/en/trunk/reference/mongo/mongo/setpoolsize.xml 2012-11-07 15:59:17 UTC (rev 328271)
@@ -15,7 +15,7 @@
</methodsynopsis>
<warning xmlns="http://docbook.org/ns/docbook">
- <simpara>This feature has been <emphasis>DEPRECATED</emphasis> as of version
+ <simpara>This method has been <emphasis>DEPRECATED</emphasis> as of version
1.2.3. Relying on this feature is highly discouraged. Please use
<function>MongoPool::setSize</function> instead.
</simpara>