https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112565

Revision: 112565
Author:   demon
Date:     2012-02-28 02:18:18 +0000 (Tue, 28 Feb 2012)
Log Message:
-----------
(bug 34762) Calling close() on a DatabaseBase object now clears the connection. 
Based on patch by Christian.

By the way, the duplication here is stupid.

Modified Paths:
--------------
    trunk/phase3/RELEASE-NOTES-1.20
    trunk/phase3/includes/db/DatabaseIbm_db2.php
    trunk/phase3/includes/db/DatabaseMssql.php
    trunk/phase3/includes/db/DatabaseMysql.php
    trunk/phase3/includes/db/DatabaseOracle.php
    trunk/phase3/includes/db/DatabasePostgres.php

Modified: trunk/phase3/RELEASE-NOTES-1.20
===================================================================
--- trunk/phase3/RELEASE-NOTES-1.20     2012-02-28 02:09:18 UTC (rev 112564)
+++ trunk/phase3/RELEASE-NOTES-1.20     2012-02-28 02:18:18 UTC (rev 112565)
@@ -36,6 +36,7 @@
   history compression method.
 * (bug 34702) Localised parentheses are now used in more special pages.
 * (bug 34723) When editing a script page on a RTL wiki the textbox should be 
LTR.
+* (bug 34762) Calling close() on a DatabaseBase object now clears the 
connection.
 
 === API changes in 1.20 ===
 * (bug 34316) Add ability to retrieve maximum upload size from MediaWiki API.

Modified: trunk/phase3/includes/db/DatabaseIbm_db2.php
===================================================================
--- trunk/phase3/includes/db/DatabaseIbm_db2.php        2012-02-28 02:09:18 UTC 
(rev 112564)
+++ trunk/phase3/includes/db/DatabaseIbm_db2.php        2012-02-28 02:18:18 UTC 
(rev 112565)
@@ -563,7 +563,9 @@
                        if ( $this->trxLevel() > 0 ) {
                                $this->commit( __METHOD__ );
                        }
-                       return db2_close( $this->mConn );
+                       $ret = db2_close( $this->mConn );
+                       $this->mConn = null;
+                       return $ret;
                } else {
                        return true;
                }

Modified: trunk/phase3/includes/db/DatabaseMssql.php
===================================================================
--- trunk/phase3/includes/db/DatabaseMssql.php  2012-02-28 02:09:18 UTC (rev 
112564)
+++ trunk/phase3/includes/db/DatabaseMssql.php  2012-02-28 02:18:18 UTC (rev 
112565)
@@ -113,7 +113,9 @@
        function close() {
                $this->mOpened = false;
                if ( $this->mConn ) {
-                       return sqlsrv_close( $this->mConn );
+                       $ret = sqlsrv_close( $this->mConn );
+                       $this->mConn = null;
+                       return $ret;
                } else {
                        return true;
                }

Modified: trunk/phase3/includes/db/DatabaseMysql.php
===================================================================
--- trunk/phase3/includes/db/DatabaseMysql.php  2012-02-28 02:09:18 UTC (rev 
112564)
+++ trunk/phase3/includes/db/DatabaseMysql.php  2012-02-28 02:18:18 UTC (rev 
112565)
@@ -160,7 +160,9 @@
                        if ( $this->trxLevel() ) {
                                $this->commit( __METHOD__ );
                        }
-                       return mysql_close( $this->mConn );
+                       $ret = mysql_close( $this->mConn );
+                       $this->mConn = false;
+                       return $ret;
                } else {
                        return true;
                }

Modified: trunk/phase3/includes/db/DatabaseOracle.php
===================================================================
--- trunk/phase3/includes/db/DatabaseOracle.php 2012-02-28 02:09:18 UTC (rev 
112564)
+++ trunk/phase3/includes/db/DatabaseOracle.php 2012-02-28 02:18:18 UTC (rev 
112565)
@@ -294,7 +294,9 @@
                        if ( $this->mTrxLevel ) {
                                $this->commit( __METHOD__ );
                        }
-                       return oci_close( $this->mConn );
+                       $ret = oci_close( $this->mConn );
+                       $this->mConn = null;
+                       return null;
                } else {
                        return true;
                }

Modified: trunk/phase3/includes/db/DatabasePostgres.php
===================================================================
--- trunk/phase3/includes/db/DatabasePostgres.php       2012-02-28 02:09:18 UTC 
(rev 112564)
+++ trunk/phase3/includes/db/DatabasePostgres.php       2012-02-28 02:18:18 UTC 
(rev 112565)
@@ -243,7 +243,9 @@
        function close() {
                $this->mOpened = false;
                if ( $this->mConn ) {
-                       return pg_close( $this->mConn );
+                       $ret = pg_close( $this->mConn );
+                       $this->mConn = null;
+                       return $ret;
                } else {
                        return true;
                }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to