From: Aaron Schulz Date: Fri, 22 Mar 2013 20:48:00 +0000 (+0000) Subject: Revert "Misc follow-ups to I2fc3966e (a161c5e)" X-Git-Tag: 1.31.0-rc.0~20247 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22lang_raccourcis%22%2C%22module=%24nom_module%22%29%20.%20%22?a=commitdiff_plain;h=e8e2474c8f4518e5ad710b40ac719e4b4343a4f0;p=lhc%2Fweb%2Fwiklou.git Revert "Misc follow-ups to I2fc3966e (a161c5e)" That apparently caused bug 46397. This reverts commit 388b14a15de6c531d876796dde02605f046fcf53 Bug : 46397 Change-Id: Ideaa86f0d535873a08e27d6f98f6bd4255b8c594 --- diff --git a/includes/Title.php b/includes/Title.php index bfbb06ff96..974ea9120f 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -680,7 +680,6 @@ class Title { public function getContentModel() { if ( !$this->mContentModel ) { $linkCache = LinkCache::singleton(); - $linkCache->addLinkObj( $this ); $this->mContentModel = $linkCache->getGoodLinkFieldObj( $this, 'model' ); } @@ -2948,21 +2947,22 @@ class Title { * @return Bool */ public function isRedirect( $flags = 0 ) { - if ( !( $flags & Title::GAID_FOR_UPDATE ) && !is_null( $this->mRedirect ) ) { + if ( !is_null( $this->mRedirect ) ) { return $this->mRedirect; } - + # Calling getArticleID() loads the field from cache as needed if ( !$this->getArticleID( $flags ) ) { return $this->mRedirect = false; } $linkCache = LinkCache::singleton(); - $linkCache->addLinkObj( $this ); $cached = $linkCache->getGoodLinkFieldObj( $this, 'redirect' ); - if ( $cached === null ) { - // Should not happen - throw new MWException( "LinkCache doesn't know redirect status of this title: " . $this->getPrefixedDBkey() ); + // TODO: check the assumption that the cache actually knows about this title + // and handle this, such as get the title from the database. + // See https://bugzilla.wikimedia.org/show_bug.cgi?id=37209 + wfDebug( "LinkCache doesn't currently know about this title: " . $this->getPrefixedDBkey() ); + wfDebug( wfBacktrace() ); } $this->mRedirect = (bool)$cached; @@ -2978,21 +2978,20 @@ class Title { * @return Int */ public function getLength( $flags = 0 ) { - if ( !( $flags & Title::GAID_FOR_UPDATE ) && $this->mLength != -1 ) { + if ( $this->mLength != -1 ) { return $this->mLength; } - + # Calling getArticleID() loads the field from cache as needed if ( !$this->getArticleID( $flags ) ) { return $this->mLength = 0; } - $linkCache = LinkCache::singleton(); - $linkCache->addLinkObj( $this ); $cached = $linkCache->getGoodLinkFieldObj( $this, 'length' ); - - if ( $cached === null ) { - // Should not happen - throw new MWException( "LinkCache doesn't know redirect status of this title: " . $this->getPrefixedDBkey() ); + if ( $cached === null ) { # check the assumption that the cache actually knows about this title + # XXX: this does apparently happen, see https://bugzilla.wikimedia.org/show_bug.cgi?id=37209 + # as a stop gap, perhaps log this, but don't throw an exception? + wfDebug( "LinkCache doesn't currently know about this title: " . $this->getPrefixedDBkey() ); + wfDebug( wfBacktrace() ); } $this->mLength = intval( $cached ); @@ -3011,18 +3010,17 @@ class Title { if ( !( $flags & Title::GAID_FOR_UPDATE ) && $this->mLatestID !== false ) { return intval( $this->mLatestID ); } - + # Calling getArticleID() loads the field from cache as needed if ( !$this->getArticleID( $flags ) ) { return $this->mLatestID = 0; } - $linkCache = LinkCache::singleton(); $linkCache->addLinkObj( $this ); $cached = $linkCache->getGoodLinkFieldObj( $this, 'revision' ); - - if ( $cached === null ) { - // Should not happen - throw new MWException( "LinkCache doesn't know latest revision ID of this title: " . $this->getPrefixedDBkey() ); + if ( $cached === null ) { # check the assumption that the cache actually knows about this title + # XXX: this does apparently happen, see https://bugzilla.wikimedia.org/show_bug.cgi?id=37209 + # as a stop gap, perhaps log this, but don't throw an exception? + throw new MWException( "LinkCache doesn't currently know about this title: " . $this->getPrefixedDBkey() ); } $this->mLatestID = intval( $cached ); diff --git a/tests/phpunit/includes/ExtraParserTest.php b/tests/phpunit/includes/ExtraParserTest.php index c8400568fb..07215c121e 100644 --- a/tests/phpunit/includes/ExtraParserTest.php +++ b/tests/phpunit/includes/ExtraParserTest.php @@ -26,11 +26,7 @@ class ExtraParserTest extends MediaWikiTestCase { MagicWord::clearCache(); } - /** - * Bug 8689 - Long numeric lines kill the parser - * - * @group Database - */ + // Bug 8689 - Long numeric lines kill the parser function testBug8689() { global $wgUser; $longLine = '1.' . str_repeat( '1234567890', 100000 ) . "\n"; @@ -41,20 +37,13 @@ class ExtraParserTest extends MediaWikiTestCase { $this->parser->parse( $longLine, $t, $options )->getText() ); } - /** - * Test the parser entry points - * - * @group Database - */ + /* Test the parser entry points */ function testParse() { $title = Title::newFromText( __FUNCTION__ ); $parserOutput = $this->parser->parse( "Test\n{{Foo}}\n{{Bar}}", $title, $this->options ); $this->assertEquals( "

Test\nContent of Template:Foo\nContent of Template:Bar\n

", $parserOutput->getText() ); } - /** - * @group Database - */ function testPreSaveTransform() { global $wgUser; $title = Title::newFromText( __FUNCTION__ ); @@ -63,9 +52,6 @@ class ExtraParserTest extends MediaWikiTestCase { $this->assertEquals( "Test\nContent of ''Template:Foo''\n{{Bar}}", $outputText ); } - /** - * @group Database - */ function testPreprocess() { $title = Title::newFromText( __FUNCTION__ ); $outputText = $this->parser->preprocess( "Test\n{{Foo}}\n{{Bar}}", $title, $this->options ); diff --git a/tests/phpunit/includes/parser/MagicVariableTest.php b/tests/phpunit/includes/parser/MagicVariableTest.php index 75e1fd1ced..263df5f817 100644 --- a/tests/phpunit/includes/parser/MagicVariableTest.php +++ b/tests/phpunit/includes/parser/MagicVariableTest.php @@ -65,68 +65,44 @@ class MagicVariableTest extends MediaWikiTestCase { # day - /** - * @dataProvider MediaWikiProvide::Days - * @group Database - */ + /** @dataProvider MediaWikiProvide::Days */ function testCurrentdayIsUnPadded( $day ) { $this->assertUnPadded( 'currentday', $day ); } - /** - * @dataProvider MediaWikiProvide::Days - * @group Database - */ + /** @dataProvider MediaWikiProvide::Days */ function testCurrentdaytwoIsZeroPadded( $day ) { $this->assertZeroPadded( 'currentday2', $day ); } - /** - * @dataProvider MediaWikiProvide::Days - * @group Database - */ + /** @dataProvider MediaWikiProvide::Days */ function testLocaldayIsUnPadded( $day ) { $this->assertUnPadded( 'localday', $day ); } - /** - * @dataProvider MediaWikiProvide::Days - * @group Database - */ + /** @dataProvider MediaWikiProvide::Days */ function testLocaldaytwoIsZeroPadded( $day ) { $this->assertZeroPadded( 'localday2', $day ); } # month - /** - * @dataProvider MediaWikiProvide::Months - * @group Database - */ + /** @dataProvider MediaWikiProvide::Months */ function testCurrentmonthIsZeroPadded( $month ) { $this->assertZeroPadded( 'currentmonth', $month ); } - /** - * @dataProvider MediaWikiProvide::Months - * @group Database - */ + /** @dataProvider MediaWikiProvide::Months */ function testCurrentmonthoneIsUnPadded( $month ) { $this->assertUnPadded( 'currentmonth1', $month ); } - /** - * @dataProvider MediaWikiProvide::Months - * @group Database - */ + /** @dataProvider MediaWikiProvide::Months */ function testLocalmonthIsZeroPadded( $month ) { $this->assertZeroPadded( 'localmonth', $month ); } - /** - * @dataProvider MediaWikiProvide::Months - * @group Database - */ + /** @dataProvider MediaWikiProvide::Months */ function testLocalmonthoneIsUnPadded( $month ) { $this->assertUnPadded( 'localmonth1', $month ); } @@ -134,36 +110,24 @@ class MagicVariableTest extends MediaWikiTestCase { # revision day - /** - * @dataProvider MediaWikiProvide::Days - * @group Database - */ + /** @dataProvider MediaWikiProvide::Days */ function testRevisiondayIsUnPadded( $day ) { $this->assertUnPadded( 'revisionday', $day ); } - /** - * @dataProvider MediaWikiProvide::Days - * @group Database - */ + /** @dataProvider MediaWikiProvide::Days */ function testRevisiondaytwoIsZeroPadded( $day ) { $this->assertZeroPadded( 'revisionday2', $day ); } # revision month - /** - * @dataProvider MediaWikiProvide::Months - * @group Database - */ + /** @dataProvider MediaWikiProvide::Months */ function testRevisionmonthIsZeroPadded( $month ) { $this->assertZeroPadded( 'revisionmonth', $month ); } - /** - * @dataProvider MediaWikiProvide::Months - * @group Database - */ + /** @dataProvider MediaWikiProvide::Months */ function testRevisionmonthoneIsUnPadded( $month ) { $this->assertUnPadded( 'revisionmonth1', $month ); } diff --git a/tests/phpunit/includes/parser/TagHooksTest.php b/tests/phpunit/includes/parser/TagHooksTest.php index d643264fd0..ed600790e9 100644 --- a/tests/phpunit/includes/parser/TagHooksTest.php +++ b/tests/phpunit/includes/parser/TagHooksTest.php @@ -20,7 +20,6 @@ class TagHookTest extends MediaWikiTestCase { /** * @dataProvider provideValidNames - * @group Database */ function testTagHooks( $tag ) { global $wgParserConf, $wgContLang; @@ -48,7 +47,6 @@ class TagHookTest extends MediaWikiTestCase { /** * @dataProvider provideValidNames - * @group Database */ function testFunctionTagHooks( $tag ) { global $wgParserConf, $wgContLang;