From cc6f6cd01c62f888824c005111e499505b5a5291 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 7 Aug 2018 14:44:41 +0300 Subject: [PATCH] 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 --- extension.json | 2 +- includes/ExtParserFunctions.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) 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