Removed hidden usage of $wgTitle in parser and the workarround in ExtraParserTest.php
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Wed, 22 Jun 2011 17:45:31 +0000 (17:45 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Wed, 22 Jun 2011 17:45:31 +0000 (17:45 +0000)
includes/parser/Parser.php
tests/phpunit/includes/ExtraParserTest.php

index 2640a98..d44c20c 100644 (file)
@@ -4383,11 +4383,9 @@ class Parser {
                # If we're still here, make it a link to the user page
                $userText = wfEscapeWikiText( $username );
                $nickText = wfEscapeWikiText( $nickname );
-               if ( $user->isAnon() )  {
-                       return wfMsgExt( 'signature-anon', array( 'content', 'parsemag' ), $userText, $nickText );
-               } else {
-                       return wfMsgExt( 'signature', array( 'content', 'parsemag' ), $userText, $nickText );
-               }
+               $msgName = $user->isAnon() ? 'signature-anon' : 'signature';
+
+               return wfMessage( $msgName, $userText, $nickText )->inContentLanguage()->title( $this->getTitle() )->text();
        }
 
        /**
index 54f2915..5b0aa98 100644 (file)
@@ -43,13 +43,11 @@ class ExtraParserTest extends MediaWikiTestCase {
        }
        
        function testPreSaveTransform() {
-               global $wgUser, $wgTitle;
+               global $wgUser;
                $title = Title::newFromText( __FUNCTION__ );
-               $oldTitle = $wgTitle; $wgTitle = $title; # Used by transformMsg()
                $outputText = $this->parser->preSaveTransform( "Test\r\n{{subst:Foo}}\n{{Bar}}", $title, $wgUser, $this->options );
 
                $this->assertEquals( "Test\nContent of ''Template:Foo''\n{{Bar}}", $outputText );
-               $wgTitle = $oldTitle;
        }
        
        function testPreprocess() {