Merge "Little change of readability in Title::secureAndSplit"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 25 Jan 2014 00:41:54 +0000 (00:41 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 25 Jan 2014 00:41:54 +0000 (00:41 +0000)
includes/Title.php

index 4a8f632..bdba578 100644 (file)
@@ -3214,7 +3214,8 @@ class Title {
                global $wgContLang, $wgLocalInterwiki;
 
                # Initialisation
-               $this->mInterwiki = $this->mFragment = '';
+               $this->mInterwiki = '';
+               $this->mFragment = '';
                $this->mNamespace = $this->mDefaultNamespace; # Usually NS_MAIN
 
                $dbkey = $this->mDbkeyform;
@@ -3309,10 +3310,6 @@ class Title {
                        break;
                } while ( true );
 
-               # We already know that some pages won't be in the database!
-               if ( $this->isExternal() || NS_SPECIAL == $this->mNamespace ) {
-                       $this->mArticleID = 0;
-               }
                $fragment = strstr( $dbkey, '#' );
                if ( false !== $fragment ) {
                        $this->setFragment( $fragment );
@@ -3382,9 +3379,9 @@ class Title {
                // there are numerous ways to present the same IP. Having sp:contribs scan
                // them all is silly and having some show the edits and others not is
                // inconsistent. Same for talk/userpages. Keep them normalized instead.
-               $dbkey = ( $this->mNamespace == NS_USER || $this->mNamespace == NS_USER_TALK )
-                       ? IP::sanitizeIP( $dbkey )
-                       : $dbkey;
+               if ( $this->mNamespace == NS_USER || $this->mNamespace == NS_USER_TALK ) {
+                       $dbkey = IP::sanitizeIP( $dbkey );
+               }
 
                // Any remaining initial :s are illegal.
                if ( $dbkey !== '' && ':' == $dbkey[0] ) {
@@ -3397,6 +3394,11 @@ class Title {
 
                $this->mTextform = str_replace( '_', ' ', $dbkey );
 
+               # We already know that some pages won't be in the database!
+               if ( $this->isExternal() || $this->mNamespace == NS_SPECIAL ) {
+                       $this->mArticleID = 0;
+               }
+
                return true;
        }