From 14e6f7efe15b7dd02f59f9e7824def8a8fa66f35 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 24 Jan 2014 22:30:33 +0100 Subject: [PATCH] Little change of readability in Title::secureAndSplit Move init of mArticleId to bottom, where other fields are filled and change ternary operator to a simple if for better readability. Break a double assignment in two statements. Change-Id: Ib61435e62e883142dd0c5dcb40e0e50e7ca18439 --- includes/Title.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index 79853dfe83..6c091e1518 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -3210,7 +3210,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; @@ -3305,10 +3306,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 ); @@ -3378,9 +3375,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] ) { @@ -3393,6 +3390,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; } -- 2.20.1