mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ParserFunctions
synced 2024-11-23 15:57:10 +00:00
Don't call SpecialPageFactory methods statically
This is deprecated in 1.32. Bump minimum requirement of MediaWiki to 1.32 since this is a tarball-bundled extension. Depends-On: Id8a92d57743f790b7d8c377c033cef38d1bb24de Change-Id: Ie18c7c97405124ccaa3922b4a25fa7b40496039f
This commit is contained in:
parent
65dc51cb64
commit
cc6f6cd01c
|
@ -12,7 +12,7 @@
|
|||
"license-name": "GPL-2.0-or-later",
|
||||
"type": "parserhook",
|
||||
"requires": {
|
||||
"MediaWiki": ">= 1.25.0"
|
||||
"MediaWiki": ">= 1.32.0"
|
||||
},
|
||||
"config": {
|
||||
"PFEnableStringFunctions": false,
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
class ExtParserFunctions {
|
||||
public static $mExprParser;
|
||||
public static $mTimeCache = [];
|
||||
|
@ -330,12 +332,13 @@ class ExtParserFunctions {
|
|||
$parser->mOutput->addImage(
|
||||
$file->getName(), $file->getTimestamp(), $file->getSha1() );
|
||||
return $file->exists() ? $then : $else;
|
||||
} elseif ( $title->getNamespace() === NS_SPECIAL ) {
|
||||
} elseif ( $title->isSpecialPage() ) {
|
||||
/* Don't bother with the count for special pages,
|
||||
* since their existence can be checked without
|
||||
* accessing the database.
|
||||
*/
|
||||
return SpecialPageFactory::exists( $title->getDBkey() ) ? $then : $else;
|
||||
return MediaWikiServices::getInstance()->getSpecialPageFactory()
|
||||
->exists( $title->getDBkey() ) ? $then : $else;
|
||||
} elseif ( $title->isExternal() ) {
|
||||
/* Can't check the existence of pages on other sites,
|
||||
* so just return $else. Makes a sort of sense, since
|
||||
|
|
Loading…
Reference in a new issue