diff options
author | Kevin Israel <pleasestand@live.com> | 2016-12-27 05:20:30 -0500 |
---|---|---|
committer | Kevin Israel <pleasestand@live.com> | 2016-12-27 05:20:30 -0500 |
commit | cc495efff47ab351093f408ad18a46b551b9f9cd (patch) | |
tree | 57a018eff2093009de733ac747be1d15dd0347fe /includes | |
parent | 2c4a6cc7e0a8dc393633d098e0863397da325f3a (diff) | |
download | mediawikicore-cc495efff47ab351093f408ad18a46b551b9f9cd.tar.gz mediawikicore-cc495efff47ab351093f408ad18a46b551b9f9cd.zip |
Database: Avoid internal use of ignoreErrors()
* Use $tempIgnore in DatabaseBase::tableExists() instead of ignoreErrors().
* DatabasePostgres::reportQueryError(), since 419221e4a71b, calls
ignoreErrors() before and after rollback(). This is probably not effective
as a recursion guard (reportQueryError() would be called regardless), and
for suppressing any log entry or exception, it is redundant (doRollback()
already sets $tempIgnore when calling query()).
* ignoreErrors(), now unused, can be removed in a separate change set.
Change-Id: Iee768abf996ece213146ab8f64a15a2b407a2e5e
Diffstat (limited to 'includes')
-rw-r--r-- | includes/libs/rdbms/database/Database.php | 5 | ||||
-rw-r--r-- | includes/libs/rdbms/database/DatabasePostgres.php | 2 |
2 files changed, 2 insertions, 5 deletions
diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index b9beac8662ec..69cf1ac356bf 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -1419,9 +1419,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware } $table = $this->tableName( $table ); - $old = $this->ignoreErrors( true ); - $res = $this->query( "SELECT 1 FROM $table LIMIT 1", $fname ); - $this->ignoreErrors( $old ); + $ignoreErrors = true; + $res = $this->query( "SELECT 1 FROM $table LIMIT 1", $fname, $ignoreErrors ); return (bool)$res; } diff --git a/includes/libs/rdbms/database/DatabasePostgres.php b/includes/libs/rdbms/database/DatabasePostgres.php index cd0217766e83..42113b0851c9 100644 --- a/includes/libs/rdbms/database/DatabasePostgres.php +++ b/includes/libs/rdbms/database/DatabasePostgres.php @@ -243,9 +243,7 @@ class DatabasePostgres extends Database { } /* Transaction stays in the ERROR state until rolled back */ if ( $this->mTrxLevel ) { - $ignore = $this->ignoreErrors( true ); $this->rollback( __METHOD__ ); - $this->ignoreErrors( $ignore ); } parent::reportQueryError( $error, $errno, $sql, $fname, false ); } |