From: Alexandre Emsenhuber Date: Mon, 30 May 2011 16:10:23 +0000 (+0000) Subject: * make preprocessorFuzzTest.php pass the Title object to Parser, removed checks for... X-Git-Tag: 1.31.0-rc.0~29840 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=c58ef2b85ba9072e19db85dbd42704a5c7c37a88;p=lhc%2Fweb%2Fwiklou.git * make preprocessorFuzzTest.php pass the Title object to Parser, removed checks for non-object in Parser * make the parser use ParserOptions::getUser() instead of $wgUser * fixed some E_NOTICE and E_STRICT in preprocessorFuzzTest.php --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 74480b68f4..010da1f5e6 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -5461,9 +5461,6 @@ class Parser { * @return string */ function testSrvus( $text, $title, ParserOptions $options, $outputType = self::OT_HTML ) { - if ( !$title instanceof Title ) { - $title = Title::newFromText( $title ); - } $this->startParse( $title, $options, $outputType, true ); $text = $this->replaceVariables( $text ); @@ -5473,17 +5470,10 @@ class Parser { } function testPst( $text, $title, $options ) { - global $wgUser; - if ( !$title instanceof Title ) { - $title = Title::newFromText( $title ); - } - return $this->preSaveTransform( $text, $title, $wgUser, $options ); + return $this->preSaveTransform( $text, $title, $options->getUser(), $options ); } function testPreprocess( $text, $title, $options ) { - if ( !$title instanceof Title ) { - $title = Title::newFromText( $title ); - } return $this->testSrvus( $text, $title, $options, self::OT_PREPROCESS ); } diff --git a/maintenance/preprocessorFuzzTest.php b/maintenance/preprocessorFuzzTest.php index fbf3b93227..20eb0c472c 100644 --- a/maintenance/preprocessorFuzzTest.php +++ b/maintenance/preprocessorFuzzTest.php @@ -190,10 +190,10 @@ class PPFuzzTest { $wgUser->mFrom = 'name'; $wgUser->ppfz_test = $this; - $options = new ParserOptions; + $options = ParserOptions::newFromUser( $wgUser ); $options->setTemplateCallback( array( $this, 'templateHook' ) ); $options->setTimestamp( wfTimestampNow() ); - $this->output = call_user_func( array( $wgParser, $this->entryPoint ), $this->mainText, $this->title->getPrefixedText(), $options ); + $this->output = call_user_func( array( $wgParser, $this->entryPoint ), $this->mainText, $this->title, $options ); return $this->output; } @@ -217,7 +217,7 @@ class PPFuzzTest { } class PPFuzzUser extends User { - var $ppfz_test; + var $ppfz_test, $mDataLoaded; function load() { if ( $this->mDataLoaded ) { @@ -227,13 +227,13 @@ class PPFuzzUser extends User { $this->loadDefaults( $this->mName ); } - function getOption( $option, $defaultOverride = '' ) { + function getOption( $oname, $defaultOverride = null, $ignoreHidden = false ) { if ( $option === 'fancysig' ) { return $this->ppfz_test->fancySig; } elseif ( $option === 'nickname' ) { return $this->ppfz_test->nickname; } else { - return parent::getOption( $option, $defaultOverride ); + return parent::getOption( $option, $defaultOverride, $ignoreHidden ); } } }