From d459d8de7519b65545fb3e25f8cde95b47d7e64c Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Sat, 9 Mar 2019 23:37:49 +0100 Subject: [PATCH] maintenance: Replace deprecated global $wgParser with getParser() service $wgParser is deprecated and using globals should also be avoid. So, replacing the use of global $wgParser by a mediawiki service. Change-Id: I34b61338e500567773249c71da0a7125cfd50d02 --- maintenance/formatInstallDoc.php | 6 ++++-- maintenance/preprocessDump.php | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/maintenance/formatInstallDoc.php b/maintenance/formatInstallDoc.php index 3d34be1477..160a20dcaf 100644 --- a/maintenance/formatInstallDoc.php +++ b/maintenance/formatInstallDoc.php @@ -21,6 +21,8 @@ * @ingroup Maintenance */ +use MediaWiki\MediaWikiServices; + require_once __DIR__ . '/Maintenance.php'; /** @@ -61,10 +63,10 @@ class FormatInstallDoc extends Maintenance { $outText = InstallDocFormatter::format( $inText ); if ( $this->hasOption( 'html' ) ) { - global $wgParser; + $parser = MediaWikiServices::getInstance()->getParser(); $opt = new ParserOptions; $title = Title::newFromText( 'Text file' ); - $out = $wgParser->parse( $outText, $title, $opt ); + $out = $parser->parse( $outText, $title, $opt ); $outText = "\n" . $out->getText() . "\n\n"; } diff --git a/maintenance/preprocessDump.php b/maintenance/preprocessDump.php index f8526d0c33..75904d0c68 100644 --- a/maintenance/preprocessDump.php +++ b/maintenance/preprocessDump.php @@ -25,6 +25,8 @@ * @ingroup Maintenance */ +use MediaWiki\MediaWikiServices; + require_once __DIR__ . '/dumpIterator.php'; /** @@ -40,9 +42,9 @@ class PreprocessDump extends DumpIterator { public $mPPNodeCount = 0; public function getStripList() { - global $wgParser; + $parser = MediaWikiServices::getInstance()->getParser(); - return $wgParser->getStripList(); + return $parser->getStripList(); } public function __construct() { -- 2.20.1