From 67f1342af9f63ec35dc1fd5d9f302ea69cf2fa1b Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 2 Sep 2010 20:48:02 +0000 Subject: [PATCH] Simplify some returns, remove some whitespace Indent on a switch --- includes/Title.php | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index e7a83514cc..b991993fce 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -3569,14 +3569,13 @@ class Title { . " ORDER BY cl_sortkey"; $res = $dbr->query( $sql ); + $data = array(); if ( $dbr->numRows( $res ) > 0 ) { foreach ( $res as $row ) { // $data[] = Title::newFromText($wgContLang->getNSText ( NS_CATEGORY ).':'.$row->cl_to); $data[$wgContLang->getNSText( NS_CATEGORY ) . ':' . $row->cl_to] = $this->getFullText(); } - } else { - $data = array(); } return $data; } @@ -3603,10 +3602,9 @@ class Title { } } } - return $stack; - } else { - return array(); } + + return $stack; } @@ -3801,21 +3799,21 @@ class Title { return true; // any interwiki link might be viewable, for all we know } switch( $this->mNamespace ) { - case NS_MEDIA: - case NS_FILE: - return (bool)wfFindFile( $this ); // file exists, possibly in a foreign repo - case NS_SPECIAL: - return SpecialPage::exists( $this->getDBkey() ); // valid special page - case NS_MAIN: - return $this->mDbkeyform == ''; // selflink, possibly with fragment - case NS_MEDIAWIKI: - // If the page is form Mediawiki:message/lang, calling wfMsgWeirdKey causes - // the full l10n of that language to be loaded. That takes much memory and - // isn't needed. So we strip the language part away. - list( $basename, /* rest */ ) = explode( '/', $this->mDbkeyform, 2 ); - return (bool)wfMsgWeirdKey( $basename ); // known system message - default: - return false; + case NS_MEDIA: + case NS_FILE: + return (bool)wfFindFile( $this ); // file exists, possibly in a foreign repo + case NS_SPECIAL: + return SpecialPage::exists( $this->getDBkey() ); // valid special page + case NS_MAIN: + return $this->mDbkeyform == ''; // selflink, possibly with fragment + case NS_MEDIAWIKI: + // If the page is form Mediawiki:message/lang, calling wfMsgWeirdKey causes + // the full l10n of that language to be loaded. That takes much memory and + // isn't needed. So we strip the language part away. + list( $basename, /* rest */ ) = explode( '/', $this->mDbkeyform, 2 ); + return (bool)wfMsgWeirdKey( $basename ); // known system message + default: + return false; } } @@ -4080,7 +4078,6 @@ class Title { __METHOD__ ); - foreach ( $res as $row ) { $redirs[] = self::newFromRow( $row ); } -- 2.20.1