From: Chad Horohoe Date: Tue, 28 Feb 2012 02:18:18 +0000 (+0000) Subject: (bug 34762) Calling close() on a DatabaseBase object now clears the connection. Based... X-Git-Tag: 1.31.0-rc.0~24475 X-Git-Url: http://git.cyclocoop.org/%22.htmlspecialchars%28%24url_syndic%29.%22?a=commitdiff_plain;h=2177a4d8b47e6d0a9761a0c5d1f0da2087844174;p=lhc%2Fweb%2Fwiklou.git (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. --- diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index 62461ed3ec..d0bceee67e 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -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. diff --git a/includes/db/DatabaseIbm_db2.php b/includes/db/DatabaseIbm_db2.php index 4d9e7075cd..83155b3d06 100644 --- a/includes/db/DatabaseIbm_db2.php +++ b/includes/db/DatabaseIbm_db2.php @@ -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; } diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index cf5ee940ba..4b7dab2658 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -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; } diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index 23d6531c12..808cb48ca8 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -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; } diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 32a38adae0..d3527ad023 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -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; } diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index 978bfc7c0e..2e1c6b7a4a 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -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; }