(bug 34762) Calling close() on a DatabaseBase object now clears the connection. Based...
authorChad Horohoe <demon@users.mediawiki.org>
Tue, 28 Feb 2012 02:18:18 +0000 (02:18 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Tue, 28 Feb 2012 02:18:18 +0000 (02:18 +0000)
By the way, the duplication here is stupid.

RELEASE-NOTES-1.20
includes/db/DatabaseIbm_db2.php
includes/db/DatabaseMssql.php
includes/db/DatabaseMysql.php
includes/db/DatabaseOracle.php
includes/db/DatabasePostgres.php

index 62461ed..d0bceee 100644 (file)
@@ -36,6 +36,7 @@ production.
   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.
index 4d9e707..83155b3 100644 (file)
@@ -563,7 +563,9 @@ class DatabaseIbm_db2 extends DatabaseBase {
                        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;
                }
index cf5ee94..4b7dab2 100644 (file)
@@ -113,7 +113,9 @@ class DatabaseMssql extends DatabaseBase {
        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;
                }
index 23d6531..808cb48 100644 (file)
@@ -160,7 +160,9 @@ class DatabaseMysql extends DatabaseBase {
                        if ( $this->trxLevel() ) {
                                $this->commit( __METHOD__ );
                        }
-                       return mysql_close( $this->mConn );
+                       $ret = mysql_close( $this->mConn );
+                       $this->mConn = false;
+                       return $ret;
                } else {
                        return true;
                }
index 32a38ad..d3527ad 100644 (file)
@@ -294,7 +294,9 @@ class DatabaseOracle extends DatabaseBase {
                        if ( $this->mTrxLevel ) {
                                $this->commit( __METHOD__ );
                        }
-                       return oci_close( $this->mConn );
+                       $ret = oci_close( $this->mConn );
+                       $this->mConn = null;
+                       return null;
                } else {
                        return true;
                }
index 978bfc7..2e1c6b7 100644 (file)
@@ -243,7 +243,9 @@ class DatabasePostgres extends DatabaseBase {
        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;
                }