Replace use of deprecated Parser::$mTitle

Parser::getTitle is also deprecated,
using getPage + TitleFormatter instead

Bug: T275160
Change-Id: I90b0bba6c2a8283f2257dbf2e140e893e3f62442
This commit is contained in:
Umherirrender 2022-12-27 13:00:16 +01:00
parent 21964ef377
commit 890c1ed9b8

View file

@ -2,6 +2,7 @@
namespace MediaWiki\Extension\TitleBlacklist;
use MediaWiki\MediaWikiServices;
use Scribunto_LuaLibraryBase;
class Scribunto_LuaTitleBlacklistLibrary extends Scribunto_LuaLibraryBase {
@ -20,7 +21,12 @@ class Scribunto_LuaTitleBlacklistLibrary extends Scribunto_LuaLibraryBase {
$this->checkTypeOptional( 'mw.ext.TitleBlacklist.test', 2, $title, 'string', '' );
$this->incrementExpensiveFunctionCount();
if ( $title == '' ) {
$title = $this->getParser()->mTitle->getPrefixedText();
$page = $this->getParser()->getPage();
if ( !$page ) {
// Nothing to check
return [ null ];
}
$title = MediaWikiServices::getInstance()->getTitleFormatter()->getPrefixedText( $page );
}
$entry = TitleBlacklist::singleton()->isBlacklisted( $title, $action );
if ( $entry ) {