r49012 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49011‎ | r49012 | r49013 >
Date:16:18, 29 March 2009
Author:ashley
Status:ok
Tags:
Comment:
minor coding style tweaks to Interwiki.php
Modified paths:
  • /trunk/phase3/includes/Interwiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Interwiki.php
@@ -17,8 +17,7 @@
1818
1919 protected $mPrefix, $mURL, $mLocal, $mTrans;
2020
21 - function __construct( $prefix = null, $url = '', $local = 0, $trans = 0 )
22 - {
 21+ function __construct( $prefix = null, $url = '', $local = 0, $trans = 0 ){
2322 $this->mPrefix = $prefix;
2423 $this->mURL = $url;
2524 $this->mLocal = $local;
@@ -52,7 +51,7 @@
5352 return self::$smCache[$prefix];
5453 }
5554 global $wgInterwikiCache;
56 - if ($wgInterwikiCache) {
 55+ if( $wgInterwikiCache ) {
5756 $iw = Interwiki::getInterwikiCached( $prefix );
5857 } else {
5958 $iw = Interwiki::load( $prefix );
@@ -67,7 +66,7 @@
6867 self::$smCache[$prefix] = $iw;
6968 return $iw;
7069 }
71 -
 70+
7271 /**
7372 * Fetch interwiki prefix data from local cache in constant database.
7473 *
@@ -78,19 +77,19 @@
7978 */
8079 protected static function getInterwikiCached( $prefix ) {
8180 $value = self::getInterwikiCacheEntry( $prefix );
82 -
 81+
8382 $s = new Interwiki( $prefix );
8483 if ( $value != '' ) {
8584 // Split values
8685 list( $local, $url ) = explode( ' ', $value, 2 );
8786 $s->mURL = $url;
8887 $s->mLocal = (int)$local;
89 - }else{
 88+ } else {
9089 $s = false;
9190 }
9291 return $s;
9392 }
94 -
 93+
9594 /**
9695 * Get entry from interwiki cache
9796 *
@@ -110,11 +109,11 @@
111110 /* Resolve site name */
112111 if( $wgInterwikiScopes>=3 && !$site ) {
113112 $site = dba_fetch( '__sites:' . wfWikiID(), $db );
114 - if ( $site == "" ){
 113+ if ( $site == '' ){
115114 $site = $wgInterwikiFallbackSite;
116115 }
117116 }
118 -
 117+
119118 $value = dba_fetch( wfMemcKey( $prefix ), $db );
120119 // Site level
121120 if ( $value == '' && $wgInterwikiScopes >= 3 ) {
@@ -126,7 +125,7 @@
127126 }
128127 if ( $value == 'undef' )
129128 $value = '';
130 -
 129+
131130 return $value;
132131 }
133132
@@ -136,7 +135,6 @@
137136 * @param $prefix The interwiki prefix
138137 * @return bool The prefix is valid
139138 * @static
140 - *
141139 */
142140 protected static function load( $prefix ) {
143141 global $wgMemc, $wgInterwikiExpiry;
@@ -149,9 +147,9 @@
150148 return $iw;
151149 }
152150 }
153 -
 151+
154152 $db = wfGetDB( DB_SLAVE );
155 -
 153+
156154 $row = $db->fetchRow( $db->select( 'interwiki', '*', array( 'iw_prefix' => $prefix ),
157155 __METHOD__ ) );
158156 $iw = Interwiki::loadFromArray( $row );
@@ -160,7 +158,7 @@
161159 $wgMemc->add( $key, $mc, $wgInterwikiExpiry );
162160 return $iw;
163161 }
164 -
 162+
165163 return false;
166164 }
167165
@@ -181,8 +179,8 @@
182180 }
183181 return false;
184182 }
185 -
186 - /**
 183+
 184+ /**
187185 * Get the URL for a particular title (or with $1 if no title given)
188186 *
189187 * @param $title string What text to put for the article name
@@ -195,11 +193,11 @@
196194 }
197195 return $url;
198196 }
199 -
 197+
200198 function isLocal(){
201199 return $this->mLocal;
202200 }
203 -
 201+
204202 function isTranscludable(){
205203 return $this->mTrans;
206204 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r49050Tweak brackets from r49012aaron23:16, 30 March 2009

Status & tagging log