From: Aaron Schulz Date: Sun, 8 Mar 2015 15:06:29 +0000 (-0700) Subject: Made DB ignoreErrors() method protected X-Git-Tag: 1.31.0-rc.0~10689 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=c2e45cdde10da7b66925a64d46ff62386cd546f3;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26 index 46ffe3619a..ec6bca5d1a 100644 --- a/RELEASE-NOTES-1.26 +++ b/RELEASE-NOTES-1.26 @@ -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 == diff --git a/includes/db/Database.php b/includes/db/Database.php index d7acb42a8f..2ee45451d3 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -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 ); } diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 0ce056fae6..43d8ce8691 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -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 diff --git a/tests/phpunit/includes/db/ORMTableTest.php b/tests/phpunit/includes/db/ORMTableTest.php index 338d931f9a..764560d528 100644 --- a/tests/phpunit/includes/db/ORMTableTest.php +++ b/tests/phpunit/includes/db/ORMTableTest.php @@ -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 ); - } } /**