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:
Aryeh Gregor 2018-08-07 14:44:41 +03:00 committed by James D. Forrester
parent 65dc51cb64
commit cc6f6cd01c
2 changed files with 6 additions and 3 deletions

View file

@ -12,7 +12,7 @@
"license-name": "GPL-2.0-or-later", "license-name": "GPL-2.0-or-later",
"type": "parserhook", "type": "parserhook",
"requires": { "requires": {
"MediaWiki": ">= 1.25.0" "MediaWiki": ">= 1.32.0"
}, },
"config": { "config": {
"PFEnableStringFunctions": false, "PFEnableStringFunctions": false,

View file

@ -1,5 +1,7 @@
<?php <?php
use MediaWiki\MediaWikiServices;
class ExtParserFunctions { class ExtParserFunctions {
public static $mExprParser; public static $mExprParser;
public static $mTimeCache = []; public static $mTimeCache = [];
@ -330,12 +332,13 @@ class ExtParserFunctions {
$parser->mOutput->addImage( $parser->mOutput->addImage(
$file->getName(), $file->getTimestamp(), $file->getSha1() ); $file->getName(), $file->getTimestamp(), $file->getSha1() );
return $file->exists() ? $then : $else; return $file->exists() ? $then : $else;
} elseif ( $title->getNamespace() === NS_SPECIAL ) { } elseif ( $title->isSpecialPage() ) {
/* Don't bother with the count for special pages, /* Don't bother with the count for special pages,
* since their existence can be checked without * since their existence can be checked without
* accessing the database. * accessing the database.
*/ */
return SpecialPageFactory::exists( $title->getDBkey() ) ? $then : $else; return MediaWikiServices::getInstance()->getSpecialPageFactory()
->exists( $title->getDBkey() ) ? $then : $else;
} elseif ( $title->isExternal() ) { } elseif ( $title->isExternal() ) {
/* Can't check the existence of pages on other sites, /* Can't check the existence of pages on other sites,
* so just return $else. Makes a sort of sense, since * so just return $else. Makes a sort of sense, since