http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89176

Revision: 89176
Author:   ialex
Date:     2011-05-30 16:10:23 +0000 (Mon, 30 May 2011)
Log Message:
-----------
* 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

Modified Paths:
--------------
    trunk/phase3/includes/parser/Parser.php
    trunk/phase3/maintenance/preprocessorFuzzTest.php

Modified: trunk/phase3/includes/parser/Parser.php
===================================================================
--- trunk/phase3/includes/parser/Parser.php     2011-05-30 16:01:14 UTC (rev 
89175)
+++ trunk/phase3/includes/parser/Parser.php     2011-05-30 16:10:23 UTC (rev 
89176)
@@ -5461,9 +5461,6 @@
         * @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 @@
        }
 
        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 );
        }
 

Modified: trunk/phase3/maintenance/preprocessorFuzzTest.php
===================================================================
--- trunk/phase3/maintenance/preprocessorFuzzTest.php   2011-05-30 16:01:14 UTC 
(rev 89175)
+++ trunk/phase3/maintenance/preprocessorFuzzTest.php   2011-05-30 16:10:23 UTC 
(rev 89176)
@@ -190,10 +190,10 @@
                $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 PPFuzzUser extends User {
-       var $ppfz_test;
+       var $ppfz_test, $mDataLoaded;
 
        function load() {
                if ( $this->mDataLoaded ) {
@@ -227,13 +227,13 @@
                $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 );
                }
        }
 }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to