r112565 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112564‎ | r112565 | r112566 >
Date:02:18, 28 February 2012
Author:demon
Status:ok
Tags:
Comment:
(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 (modified) (history)
  • /trunk/phase3/includes/db/DatabaseIbm_db2.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseMssql.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseMysql.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)
  • /trunk/phase3/includes/db/DatabasePostgres.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseMysql.php
@@ -160,7 +160,9 @@
161161 if ( $this->trxLevel() ) {
162162 $this->commit( __METHOD__ );
163163 }
164 - return mysql_close( $this->mConn );
 164+ $ret = mysql_close( $this->mConn );
 165+ $this->mConn = false;
 166+ return $ret;
165167 } else {
166168 return true;
167169 }
Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -294,7 +294,9 @@
295295 if ( $this->mTrxLevel ) {
296296 $this->commit( __METHOD__ );
297297 }
298 - return oci_close( $this->mConn );
 298+ $ret = oci_close( $this->mConn );
 299+ $this->mConn = null;
 300+ return null;
299301 } else {
300302 return true;
301303 }
Index: trunk/phase3/includes/db/DatabasePostgres.php
@@ -243,7 +243,9 @@
244244 function close() {
245245 $this->mOpened = false;
246246 if ( $this->mConn ) {
247 - return pg_close( $this->mConn );
 247+ $ret = pg_close( $this->mConn );
 248+ $this->mConn = null;
 249+ return $ret;
248250 } else {
249251 return true;
250252 }
Index: trunk/phase3/includes/db/DatabaseIbm_db2.php
@@ -563,7 +563,9 @@
564564 if ( $this->trxLevel() > 0 ) {
565565 $this->commit( __METHOD__ );
566566 }
567 - return db2_close( $this->mConn );
 567+ $ret = db2_close( $this->mConn );
 568+ $this->mConn = null;
 569+ return $ret;
568570 } else {
569571 return true;
570572 }
Index: trunk/phase3/includes/db/DatabaseMssql.php
@@ -113,7 +113,9 @@
114114 function close() {
115115 $this->mOpened = false;
116116 if ( $this->mConn ) {
117 - return sqlsrv_close( $this->mConn );
 117+ $ret = sqlsrv_close( $this->mConn );
 118+ $this->mConn = null;
 119+ return $ret;
118120 } else {
119121 return true;
120122 }
Index: trunk/phase3/RELEASE-NOTES-1.20
@@ -36,6 +36,7 @@
3737 history compression method.
3838 * (bug 34702) Localised parentheses are now used in more special pages.
3939 * (bug 34723) When editing a script page on a RTL wiki the textbox should be LTR.
 40+* (bug 34762) Calling close() on a DatabaseBase object now clears the connection.
4041
4142 === API changes in 1.20 ===
4243 * (bug 34316) Add ability to retrieve maximum upload size from MediaWiki API.

Follow-up revisions

RevisionCommit summaryAuthorDate
r112598Follow-up r112565: fix code duplicationmaxsem14:42, 28 February 2012

Status & tagging log