Use isSpecialPage() where possible
authorFomafix <fomafix@googlemail.com>
Sat, 29 Apr 2017 20:22:46 +0000 (22:22 +0200)
committerFomafix <fomafix@googlemail.com>
Sat, 29 Apr 2017 20:31:42 +0000 (22:31 +0200)
Change-Id: Ie4d0838acf96a7ed4a1fe4cfdc901c77d3312174

includes/MediaWiki.php
includes/Title.php
includes/parser/ParserOutput.php

index 0fd6b92..b18414d 100644 (file)
@@ -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 {
index dd6aaef..e460cda 100644 (file)
@@ -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;
                }
 
index 7de3b30..10ac192 100644 (file)
@@ -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;
                }