Replace deprecated Parser::getFreshParser

Bug: T325959
Change-Id: Idc61f7f6beda4b71959e7e9781861d56a2291f6f
This commit is contained in:
Umherirrender 2022-12-27 13:16:31 +01:00
parent 1ab96ffeb7
commit ec3f4fe4c6

View file

@ -6,6 +6,7 @@ use DOMDocument;
use MediaWiki\MediaWikiServices;
use MWHttpRequest;
use Parser;
use ParserFactory;
use PPFrame;
use Sanitizer;
use Status;
@ -37,6 +38,11 @@ class RSSParser {
*/
private $cache;
/**
* @var ParserFactory
*/
private $parserFactory;
/**
* @var RSSData
*/
@ -73,6 +79,7 @@ class RSSParser {
$this->markerString = "'\"" . wfRandomString( 32 );
$this->stripItems = [];
$this->cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
$this->parserFactory = MediaWikiServices::getInstance()->getParserFactory();
# Get max number of headlines from argument-array
if ( isset( $args['max'] ) ) {
@ -342,7 +349,7 @@ class RSSParser {
* @return string
*/
protected function sandboxParse( $wikiText, $origParser ) {
$myParser = $origParser->getFreshParser();
$myParser = $this->parserFactory->getInstance();
$result = $myParser->parse(
$wikiText,
$origParser->getTitle(),