Made DB ignoreErrors() method protected

* This should *only* ever be used internal for error suppression,
  such as in the exception reporting methods. Having it public
  means callers have to worry (in theory) about whether the
  DB handles errors one way or a totally different way even
  though there is really only meant to be one.

Change-Id: I5916830d1bd53ee948308f394e55c17dd515ad33
This commit is contained in:
Aaron Schulz 2015-03-08 08:06:29 -07:00
parent 78e7a1b786
commit c2e45cdde1
4 changed files with 2 additions and 26 deletions

View file

@ -128,6 +128,7 @@ changes to languages because of Phabricator reports.
* $wgSpecialPageGroups was removed (deprecated in 1.21).
* SpecialPageFactory::setGroup was removed (deprecated in 1.21).
* SpecialPageFactory::getGroup was removed (deprecated in 1.21).
* DatabaseBase::ignoreErrors() is now protected.
== Compatibility ==

View file

@ -230,7 +230,7 @@ abstract class DatabaseBase implements IDatabase {
* @param null|bool $ignoreErrors
* @return bool The previous value of the flag.
*/
public function ignoreErrors( $ignoreErrors = null ) {
protected function ignoreErrors( $ignoreErrors = null ) {
return wfSetBit( $this->mFlags, DBO_IGNORE, $ignoreErrors );
}

View file

@ -204,9 +204,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
while ( $this->db->trxLevel() > 0 ) {
$this->db->rollback();
}
// don't ignore DB errors
$this->db->ignoreErrors( false );
}
DeferredUpdates::clearPendingUpdates();
@ -233,9 +230,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
while ( $this->db->trxLevel() > 0 ) {
$this->db->rollback();
}
// don't ignore DB errors
$this->db->ignoreErrors( false );
}
// Restore mw globals

View file

@ -68,25 +68,6 @@ class ORMTableTest extends MediaWikiTestCase {
$this->assertInstanceOf( $class, $class::singleton() );
$this->assertTrue( $class::singleton() === $class::singleton() );
}
/**
* @since 1.21
*/
public function testIgnoreErrorsOverride() {
$table = $this->getTable();
$db = $table->getReadDbConnection();
$db->ignoreErrors( true );
try {
$table->rawSelect( "this is invalid" );
$this->fail( "An invalid query should trigger a DBQueryError even if ignoreErrors is enabled." );
} catch ( DBQueryError $ex ) {
$this->assertTrue( true, "just making phpunit happy" );
}
$db->ignoreErrors( false );
}
}
/**