Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -453,7 +453,7 @@ |
454 | 454 | * Expand templates and variables in the text, producing valid, static wikitext. |
455 | 455 | * Also removes comments. |
456 | 456 | */ |
457 | | - function preprocess( $text, $title, $options, $revid = null ) { |
| 457 | + function preprocess( $text, Title $title, ParserOptions $options, $revid = null ) { |
458 | 458 | wfProfileIn( __METHOD__ ); |
459 | 459 | $this->startExternalParse( $title, $options, self::OT_PREPROCESS, true ); |
460 | 460 | if ( $revid !== null ) { |
— | — | @@ -473,7 +473,7 @@ |
474 | 474 | * <noinclude>, <includeonly> etc. are parsed as for template transclusion, |
475 | 475 | * comments, templates, arguments, tags hooks and parser functions are untouched. |
476 | 476 | */ |
477 | | - public function getPreloadText( $text, $title, $options ) { |
| 477 | + public function getPreloadText( $text, Title $title, ParserOptions $options ) { |
478 | 478 | # Parser (re)initialisation |
479 | 479 | $this->startExternalParse( $title, $options, self::OT_PLAIN, true ); |
480 | 480 | |
— | — | @@ -4293,7 +4293,7 @@ |
4294 | 4294 | * Set up some variables which are usually set up in parse() |
4295 | 4295 | * so that an external function can call some class members with confidence |
4296 | 4296 | */ |
4297 | | - public function startExternalParse( &$title, $options, $outputType, $clearState = true ) { |
| 4297 | + public function startExternalParse( Title $title = null, ParserOptions $options, $outputType, $clearState = true ) { |
4298 | 4298 | $this->setTitle( $title ); |
4299 | 4299 | $this->mOptions = $options; |
4300 | 4300 | $this->setOutputType( $outputType ); |
— | — | @@ -4320,7 +4320,13 @@ |
4321 | 4321 | $executing = true; |
4322 | 4322 | |
4323 | 4323 | wfProfileIn( __METHOD__ ); |
4324 | | - $text = $this->preprocess( $text, $wgTitle, $options ); |
| 4324 | + $title = $wgTitle; |
| 4325 | + if ( !$title ) { |
| 4326 | + # It's not uncommon having a null $wgTitle in scripts. See r80898 |
| 4327 | + # Create a ghost title in such case |
| 4328 | + $title = Title::newFromText( 'Dwimmerlaik' ); |
| 4329 | + } |
| 4330 | + $text = $this->preprocess( $text, $title, $options ); |
4325 | 4331 | |
4326 | 4332 | $executing = false; |
4327 | 4333 | wfProfileOut( __METHOD__ ); |
— | — | @@ -5187,7 +5193,7 @@ |
5188 | 5194 | /** |
5189 | 5195 | * strip/replaceVariables/unstrip for preprocessor regression testing |
5190 | 5196 | */ |
5191 | | - function testSrvus( $text, $title, $options, $outputType = self::OT_HTML ) { |
| 5197 | + function testSrvus( $text, $title, ParserOptions $options, $outputType = self::OT_HTML ) { |
5192 | 5198 | if ( !$title instanceof Title ) { |
5193 | 5199 | $title = Title::newFromText( $title ); |
5194 | 5200 | } |
Index: trunk/phase3/includes/installer/Installer.php |
— | — | @@ -1427,12 +1427,7 @@ |
1428 | 1428 | protected function createMainpage( DatabaseInstaller $installer ) { |
1429 | 1429 | $status = Status::newGood(); |
1430 | 1430 | try { |
1431 | | - // STUPID STUPID $wgTitle. PST calls getUserSig(), which joyfully |
1432 | | - // calls for a parsed message and uses $wgTitle. There isn't even |
1433 | | - // a signature in this... |
1434 | | - global $wgTitle; |
1435 | | - $wgTitle = Title::newMainPage(); |
1436 | | - $article = new Article( $wgTitle ); |
| 1431 | + $article = new Article( Title::newMainPage() ); |
1437 | 1432 | $article->doEdit( wfMsgForContent( 'mainpagetext' ) . "\n\n" . |
1438 | 1433 | wfMsgForContent( 'mainpagedocfooter' ), |
1439 | 1434 | '', |