r90591 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90590‎ | r90591 | r90592 >
Date:17:45, 22 June 2011
Author:ialex
Status:ok
Tags:
Comment:
Removed hidden usage of $wgTitle in parser and the workarround in ExtraParserTest.php
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/ExtraParserTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/ExtraParserTest.php
@@ -43,13 +43,11 @@
4444 }
4545
4646 function testPreSaveTransform() {
47 - global $wgUser, $wgTitle;
 47+ global $wgUser;
4848 $title = Title::newFromText( __FUNCTION__ );
49 - $oldTitle = $wgTitle; $wgTitle = $title; # Used by transformMsg()
5049 $outputText = $this->parser->preSaveTransform( "Test\r\n{{subst:Foo}}\n{{Bar}}", $title, $wgUser, $this->options );
5150
5251 $this->assertEquals( "Test\nContent of ''Template:Foo''\n{{Bar}}", $outputText );
53 - $wgTitle = $oldTitle;
5452 }
5553
5654 function testPreprocess() {
Index: trunk/phase3/includes/parser/Parser.php
@@ -4383,11 +4383,9 @@
43844384 # If we're still here, make it a link to the user page
43854385 $userText = wfEscapeWikiText( $username );
43864386 $nickText = wfEscapeWikiText( $nickname );
4387 - if ( $user->isAnon() ) {
4388 - return wfMsgExt( 'signature-anon', array( 'content', 'parsemag' ), $userText, $nickText );
4389 - } else {
4390 - return wfMsgExt( 'signature', array( 'content', 'parsemag' ), $userText, $nickText );
4391 - }
 4387+ $msgName = $user->isAnon() ? 'signature-anon' : 'signature';
 4388+
 4389+ return wfMessage( $msgName, $userText, $nickText )->inContentLanguage()->title( $this->getTitle() )->text();
43924390 }
43934391
43944392 /**

Status & tagging log