From: Aaron Schulz Date: Thu, 5 Apr 2018 20:49:55 +0000 (-0700) Subject: rdbms: move assertOpen() call near the top of Database::query X-Git-Tag: 1.31.0-rc.0~178^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=62c45d54a4b889fbbd2c20bc82b2987573e493ec rdbms: move assertOpen() call near the top of Database::query This should be done before bothering with begin() calls or setting the value of fields like "trxDoneWrites" or "lastWriteTime". Change-Id: Ieace2870f5496fcf230c5c8381baca4b8038db1d --- diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index b3957117dc..d7336c11f6 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -1061,6 +1061,9 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware public function query( $sql, $fname = __METHOD__, $tempIgnore = false ) { $this->assertTransactionStatus( $sql, $fname ); + # Avoid fatals if close() was called + $this->assertOpen(); + $priorWritesPending = $this->writesOrCallbacksPending(); $this->lastQuery = $sql; @@ -1111,9 +1114,6 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $this->queryLogger->debug( "{$this->dbName} {$commentedSql}" ); } - # Avoid fatals if close() was called - $this->assertOpen(); - # Send the query to the server and fetch any corresponding errors $ret = $this->doProfiledQuery( $sql, $commentedSql, $isNonTempWrite, $fname ); $lastError = $this->lastError();