diff --git a/extension.json b/extension.json index 9f9f165e..b5d1eea0 100644 --- a/extension.json +++ b/extension.json @@ -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, diff --git a/includes/ExtParserFunctions.php b/includes/ExtParserFunctions.php index b944521d..aeed8606 100644 --- a/includes/ExtParserFunctions.php +++ b/includes/ExtParserFunctions.php @@ -1,5 +1,7 @@ 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