r105789 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105788‎ | r105789 | r105790 >
Date:10:16, 11 December 2011
Author:ialex
Status:ok
Tags:
Comment:
Use ParserOptions::newFromContext() instead of 'new ParserOptions' to use the local context and not $wgUser or $wgLang
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryRevisions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryRevisions.php
@@ -462,7 +462,7 @@
463463 }
464464 if ( $this->fld_content && !$revision->isDeleted( Revision::DELETED_TEXT ) ) {
465465 if ( $this->generateXML ) {
466 - $wgParser->startExternalParse( $title, new ParserOptions(), OT_PREPROCESS );
 466+ $wgParser->startExternalParse( $title, ParserOptions::newFromContext( $this->getContext() ), OT_PREPROCESS );
467467 $dom = $wgParser->preprocessToDom( $text );
468468 if ( is_callable( array( $dom, 'saveXML' ) ) ) {
469469 $xml = $dom->saveXML();
@@ -473,10 +473,10 @@
474474
475475 }
476476 if ( $this->expandTemplates && !$this->parseContent ) {
477 - $text = $wgParser->preprocess( $text, $title, new ParserOptions() );
 477+ $text = $wgParser->preprocess( $text, $title, ParserOptions::newFromContext( $this->getContext() ) );
478478 }
479479 if ( $this->parseContent ) {
480 - $text = $wgParser->parse( $text, $title, new ParserOptions() )->getText();
 480+ $text = $wgParser->parse( $text, $title, ParserOptions::newFromContext( $this->getContext() ) )->getText();
481481 }
482482 ApiResult::setContent( $vals, $text );
483483 } elseif ( $this->fld_content ) {

Status & tagging log