Drop use of wgParser, replaced in 1.32 and to be removed in 1.35

Bug: T160811
Change-Id: I6147fc4aa6d004cd848c170750a740091c336012
This commit is contained in:
James D. Forrester 2019-10-28 20:12:00 +00:00
parent edcc3ba75e
commit d0d036ea50
2 changed files with 7 additions and 7 deletions

View file

@ -1087,8 +1087,6 @@ class SimpleCaptcha {
* @private
*/
private function loadText( $title, $section, $flags = Revision::READ_LATEST ) {
global $wgParser;
$rev = Revision::newFromTitle( $title, false, $flags );
if ( is_null( $rev ) ) {
return "";
@ -1097,7 +1095,8 @@ class SimpleCaptcha {
$content = $rev->getContent();
$text = ContentHandler::getContentText( $content );
if ( $section !== '' ) {
return $wgParser->getSection( $text, $section );
return MediaWikiServices::getInstance()->getParser()
->getSection( $text, $section );
}
return $text;
@ -1110,11 +1109,12 @@ class SimpleCaptcha {
* @return array of strings
*/
private function findLinks( $title, $text ) {
global $wgParser, $wgUser;
global $wgUser;
$parser = MediaWikiServices::getInstance()->getParser();
$options = new ParserOptions();
$text = $wgParser->preSaveTransform( $text, $title, $wgUser, $options );
$out = $wgParser->parse( $text, $title, $options );
$text = $parser->preSaveTransform( $text, $title, $wgUser, $options );
$out = $parser->parse( $text, $title, $options );
return array_keys( $out->getExternalLinks() );
}

View file

@ -13,7 +13,7 @@
"license-name": "GPL-2.0-or-later",
"type": "antispam",
"requires": {
"MediaWiki": ">= 1.31.0"
"MediaWiki": ">= 1.32.0"
},
"GroupPermissions": {
"*": {