r49050 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49049‎ | r49050 | r49051 >
Date:23:16, 30 March 2009
Author:aaron
Status:ok
Tags:
Comment:
Tweak brackets from r49012
Modified paths:
  • /trunk/phase3/includes/Interwiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Interwiki.php
@@ -17,7 +17,7 @@
1818
1919 protected $mPrefix, $mURL, $mLocal, $mTrans;
2020
21 - function __construct( $prefix = null, $url = '', $local = 0, $trans = 0 ){
 21+ function __construct( $prefix = null, $url = '', $local = 0, $trans = 0 ) {
2222 $this->mPrefix = $prefix;
2323 $this->mURL = $url;
2424 $this->mLocal = $local;
@@ -30,7 +30,7 @@
3131 * @return bool Whether it exists
3232 * @param $prefix string Interwiki prefix to use
3333 */
34 - static public function isValidInterwiki( $prefix ){
 34+ static public function isValidInterwiki( $prefix ) {
3535 $result = self::fetch( $prefix );
3636 return (bool)$result;
3737 }
@@ -47,7 +47,7 @@
4848 return null;
4949 }
5050 $prefix = $wgContLang->lc( $prefix );
51 - if( isset( self::$smCache[$prefix] ) ){
 51+ if( isset( self::$smCache[$prefix] ) ) {
5252 return self::$smCache[$prefix];
5353 }
5454 global $wgInterwikiCache;
@@ -55,11 +55,11 @@
5656 $iw = Interwiki::getInterwikiCached( $prefix );
5757 } else {
5858 $iw = Interwiki::load( $prefix );
59 - if( !$iw ){
 59+ if( !$iw ) {
6060 $iw = false;
6161 }
6262 }
63 - if( self::CACHE_LIMIT && count( self::$smCache ) >= self::CACHE_LIMIT ){
 63+ if( self::CACHE_LIMIT && count( self::$smCache ) >= self::CACHE_LIMIT ) {
6464 reset( self::$smCache );
6565 unset( self::$smCache[ key( self::$smCache ) ] );
6666 }
@@ -98,18 +98,18 @@
9999 * @param $prefix \type{\string} Database key
100100 * @return \type{\string) The entry
101101 */
102 - protected static function getInterwikiCacheEntry( $prefix ){
 102+ protected static function getInterwikiCacheEntry( $prefix ) {
103103 global $wgInterwikiCache, $wgInterwikiScopes, $wgInterwikiFallbackSite;
104104 static $db, $site;
105105
106106 wfDebug( __METHOD__ . "( $prefix )\n" );
107 - if( !$db ){
 107+ if( !$db ) {
108108 $db = dba_open( $wgInterwikiCache, 'r', 'cdb' );
109109 }
110110 /* Resolve site name */
111111 if( $wgInterwikiScopes>=3 && !$site ) {
112112 $site = dba_fetch( '__sites:' . wfWikiID(), $db );
113 - if ( $site == '' ){
 113+ if ( $site == '' ) {
114114 $site = $wgInterwikiFallbackSite;
115115 }
116116 }
@@ -141,9 +141,9 @@
142142 $key = wfMemcKey( 'interwiki', $prefix );
143143 $mc = $wgMemc->get( $key );
144144 $iw = false;
145 - if( $mc && is_array( $mc ) ){ // is_array is hack for old keys
 145+ if( $mc && is_array( $mc ) ) { // is_array is hack for old keys
146146 $iw = Interwiki::loadFromArray( $mc );
147 - if( $iw ){
 147+ if( $iw ) {
148148 return $iw;
149149 }
150150 }
@@ -170,7 +170,7 @@
171171 * @static
172172 */
173173 protected static function loadFromArray( $mc ) {
174 - if( isset( $mc['iw_url'] ) && isset( $mc['iw_local'] ) && isset( $mc['iw_trans'] ) ){
 174+ if( isset( $mc['iw_url'] ) && isset( $mc['iw_local'] ) && isset( $mc['iw_trans'] ) ) {
175175 $iw = new Interwiki();
176176 $iw->mURL = $mc['iw_url'];
177177 $iw->mLocal = $mc['iw_local'];
@@ -186,19 +186,19 @@
187187 * @param $title string What text to put for the article name
188188 * @return string The URL
189189 */
190 - function getURL( $title = null ){
 190+ function getURL( $title = null ) {
191191 $url = $this->mURL;
192 - if( $title != null ){
 192+ if( $title != null ) {
193193 $url = str_replace( "$1", $title, $url );
194194 }
195195 return $url;
196196 }
197197
198 - function isLocal(){
 198+ function isLocal() {
199199 return $this->mLocal;
200200 }
201201
202 - function isTranscludable(){
 202+ function isTranscludable() {
203203 return $this->mTrans;
204204 }
205205

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r49012minor coding style tweaks to Interwiki.phpashley16:18, 29 March 2009

Status & tagging log