Stop using old deprecated SpecialPageFactory static functions

Bug: T245686
Change-Id: If4d166c9a95bb9381ea4de560168f5d9d683d6f5
This commit is contained in:
DannyS712 2020-02-19 23:10:54 +00:00
parent b507cea87a
commit d1f6e793ee

View file

@ -1,5 +1,7 @@
<?php <?php
use MediaWiki\MediaWikiServices;
class Scribunto_LuaTitleLibrary extends Scribunto_LuaLibraryBase { class Scribunto_LuaTitleLibrary extends Scribunto_LuaLibraryBase {
// Note these caches are naturally limited to // Note these caches are naturally limited to
// $wgExpensiveParserFunctionLimit + 1 actual Title objects because any // $wgExpensiveParserFunctionLimit + 1 actual Title objects because any
@ -82,7 +84,8 @@ class Scribunto_LuaTitleLibrary extends Scribunto_LuaLibraryBase {
if ( $this->getParser() && !$title->equals( $this->getTitle() ) ) { if ( $this->getParser() && !$title->equals( $this->getTitle() ) ) {
$this->getParser()->getOutput()->addLink( $title ); $this->getParser()->getOutput()->addLink( $title );
} }
$ret['exists'] = (bool)SpecialPageFactory::exists( $title->getDBkey() ); $ret['exists'] = MediaWikiServices::getInstance()
->getSpecialPageFactory()->exists( $title->getDBkey() );
} }
if ( $ns !== NS_FILE && $ns !== NS_MEDIA ) { if ( $ns !== NS_FILE && $ns !== NS_MEDIA ) {
$ret['file'] = false; $ret['file'] = false;
@ -134,7 +137,8 @@ class Scribunto_LuaTitleLibrary extends Scribunto_LuaLibraryBase {
'contentModel' => $title->getContentModel(), 'contentModel' => $title->getContentModel(),
]; ];
if ( $title->getNamespace() === NS_SPECIAL ) { if ( $title->getNamespace() === NS_SPECIAL ) {
$ret['exists'] = (bool)SpecialPageFactory::exists( $title->getDBkey() ); $ret['exists'] = MediaWikiServices::getInstance()
->getSpecialPageFactory()->exists( $title->getDBkey() );
} else { } else {
// bug 70495: don't just check whether the ID != 0 // bug 70495: don't just check whether the ID != 0
$ret['exists'] = $title->exists(); $ret['exists'] = $title->exists();