mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-24 08:14:09 +00:00
Stop using old deprecated SpecialPageFactory static functions
Bug: T245686 Change-Id: If4d166c9a95bb9381ea4de560168f5d9d683d6f5
This commit is contained in:
parent
b507cea87a
commit
d1f6e793ee
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue