From 5c41b29993bc402c8db4c191b142f7492d4625f5 Mon Sep 17 00:00:00 2001 From: Fomafix Date: Sat, 29 Apr 2017 22:22:46 +0200 Subject: [PATCH] Use isSpecialPage() where possible Change-Id: Ie4d0838acf96a7ed4a1fe4cfdc901c77d3312174 --- includes/MediaWiki.php | 2 +- includes/Title.php | 4 ++-- includes/parser/ParserOutput.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 0fd6b92e63..b18414d7ee 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -282,7 +282,7 @@ class MediaWiki { } // Special pages ($title may have changed since if statement above) - if ( NS_SPECIAL == $title->getNamespace() ) { + if ( $title->isSpecialPage() ) { // Actions that need to be made when we have a special pages SpecialPageFactory::executePath( $title, $this->context ); } else { diff --git a/includes/Title.php b/includes/Title.php index dd6aaefe24..e460cdaaa5 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2123,7 +2123,7 @@ class Title implements LinkTarget { private function checkSpecialsAndNSPermissions( $action, $user, $errors, $rigor, $short ) { # Only 'createaccount' can be performed on special pages, # which don't actually exist in the DB. - if ( NS_SPECIAL == $this->mNamespace && $action !== 'createaccount' ) { + if ( $this->isSpecialPage() && $action !== 'createaccount' ) { $errors[] = [ 'ns-specialprotected' ]; } @@ -3426,7 +3426,7 @@ class Title implements LinkTarget { $this->mTextform = strtr( $this->mDbkeyform, '_', ' ' ); # We already know that some pages won't be in the database! - if ( $this->isExternal() || $this->mNamespace == NS_SPECIAL ) { + if ( $this->isExternal() || $this->isSpecialPage() ) { $this->mArticleID = 0; } diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 7de3b304f1..10ac1925bd 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -708,7 +708,7 @@ class ParserOutput extends CacheTime { * @since 1.25 */ public function addTrackingCategory( $msg, $title ) { - if ( $title->getNamespace() === NS_SPECIAL ) { + if ( $title->isSpecialPage() ) { wfDebug( __METHOD__ . ": Not adding tracking category $msg to special page!\n" ); return false; } -- 2.20.1