protected function createMainpage( DatabaseInstaller $installer ) {
$status = Status::newGood();
try {
- // STUPID STUPID $wgTitle. PST calls getUserSig(), which joyfully
- // calls for a parsed message and uses $wgTitle. There isn't even
- // a signature in this...
- global $wgTitle;
- $wgTitle = Title::newMainPage();
- $article = new Article( $wgTitle );
+ $article = new Article( Title::newMainPage() );
$article->doEdit( wfMsgForContent( 'mainpagetext' ) . "\n\n" .
wfMsgForContent( 'mainpagedocfooter' ),
'',
* Expand templates and variables in the text, producing valid, static wikitext.
* Also removes comments.
*/
- function preprocess( $text, $title, $options, $revid = null ) {
+ function preprocess( $text, Title $title, ParserOptions $options, $revid = null ) {
wfProfileIn( __METHOD__ );
$this->startExternalParse( $title, $options, self::OT_PREPROCESS, true );
if ( $revid !== null ) {
* <noinclude>, <includeonly> etc. are parsed as for template transclusion,
* comments, templates, arguments, tags hooks and parser functions are untouched.
*/
- public function getPreloadText( $text, $title, $options ) {
+ public function getPreloadText( $text, Title $title, ParserOptions $options ) {
# Parser (re)initialisation
$this->startExternalParse( $title, $options, self::OT_PLAIN, true );
* Set up some variables which are usually set up in parse()
* so that an external function can call some class members with confidence
*/
- public function startExternalParse( &$title, $options, $outputType, $clearState = true ) {
+ public function startExternalParse( Title $title = null, ParserOptions $options, $outputType, $clearState = true ) {
$this->setTitle( $title );
$this->mOptions = $options;
$this->setOutputType( $outputType );
$executing = true;
wfProfileIn( __METHOD__ );
- $text = $this->preprocess( $text, $wgTitle, $options );
+ $title = $wgTitle;
+ if ( !$title ) {
+ # It's not uncommon having a null $wgTitle in scripts. See r80898
+ # Create a ghost title in such case
+ $title = Title::newFromText( 'Dwimmerlaik' );
+ }
+ $text = $this->preprocess( $text, $title, $options );
$executing = false;
wfProfileOut( __METHOD__ );
/**
* strip/replaceVariables/unstrip for preprocessor regression testing
*/
- function testSrvus( $text, $title, $options, $outputType = self::OT_HTML ) {
+ function testSrvus( $text, $title, ParserOptions $options, $outputType = self::OT_HTML ) {
if ( !$title instanceof Title ) {
$title = Title::newFromText( $title );
}