CoreParserFunctions: Use Title::inNamespace instead of manual comparison
authorNiklas Laxström <niklas.laxstrom@gmail.com>
Wed, 21 Dec 2016 09:54:33 +0000 (10:54 +0100)
committerNiklas Laxström <niklas.laxstrom@gmail.com>
Wed, 21 Dec 2016 09:55:14 +0000 (10:55 +0100)
Change-Id: I60c02bc68ef0d48b1dc66ba0961275feec5789fb

includes/parser/CoreParserFunctions.php

index 51cb410..6aa3acc 100644 (file)
@@ -276,7 +276,7 @@ class CoreParserFunctions {
                }
                if ( !is_null( $title ) ) {
                        # Convert NS_MEDIA -> NS_FILE
-                       if ( $title->getNamespace() == NS_MEDIA ) {
+                       if ( $title->inNamespace( NS_MEDIA ) ) {
                                $title = Title::makeTitle( NS_FILE, $title->getDBkey() );
                        }
                        if ( !is_null( $arg ) ) {
@@ -341,7 +341,7 @@ class CoreParserFunctions {
                // allow prefix.
                $title = Title::newFromText( $username );
 
-               if ( $title && $title->getNamespace() == NS_USER ) {
+               if ( $title && $title->inNamespace( NS_USER ) ) {
                        $username = $title->getText();
                }