r110610 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110609‎ | r110610 | r110611 >
Date:20:24, 2 February 2012
Author:reedy
Status:ok
Tags:
Comment:
Documentation, whitespace

Make code use setup and checked objects, rather than conditionally assigned local variable

Remove annoying trailing newline/whitespace at the end of addWiki.php
Modified paths:
  • /trunk/extensions/UnicodeConverter/UnicodeConverter_body.php (modified) (history)
  • /trunk/extensions/WikimediaMaintenance/addWiki.php (modified) (history)
  • /trunk/extensions/WikimediaMaintenance/rebuildInterwiki.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikimediaMaintenance/rebuildInterwiki.php
@@ -124,6 +124,10 @@
125125 foreach ( $this->languageAliases as $alias => $lang ) {
126126 $reserved[$alias] = 1;
127127 }
 128+
 129+ /**
 130+ * @var $site WMFSite
 131+ */
128132 foreach ( $sites as $site ) {
129133 $reserved[$site->lateral] = 1;
130134 }
@@ -174,6 +178,9 @@
175179 }
176180
177181 # Links to multilanguage sites
 182+ /**
 183+ * @var $targetSite WMFSite
 184+ */
178185 foreach ( $sites as $targetSite ) {
179186 $sql .= $this->makeLink( array( $targetSite->lateral, $targetSite->getURL( 'en', $this->urlprotocol ), 1 ), $first, $db );
180187 }
@@ -190,6 +197,7 @@
191198 } else {
192199 # Find out which site this DB belongs to
193200 $site = false;
 201+ $matches = array();
194202 foreach ( $sites as $candidateSite ) {
195203 $suffix = $candidateSite->suffix;
196204 if ( preg_match( "/(.*)$suffix$/", $db, $matches ) ) {
@@ -213,8 +221,8 @@
214222 # Intermap links
215223 foreach ( $iwArray as $iwEntry ) {
216224 # Suppress links with the same name as the site
217 - if ( ( $suffix == 'wiki' && $iwEntry['iw_prefix'] != 'wikipedia' ) ||
218 - ( $suffix != 'wiki' && $suffix != $iwEntry['iw_prefix'] ) )
 225+ if ( ( $site->suffix == 'wiki' && $iwEntry['iw_prefix'] != 'wikipedia' ) ||
 226+ ( $site->suffix != 'wiki' && $site->suffix != $iwEntry['iw_prefix'] ) )
219227 {
220228 $sql .= $this->makeLink( $iwEntry, $first, $db );
221229 }
@@ -247,8 +255,6 @@
248256 }
249257 }
250258
251 - # ------------------------------------------------------------------------------------------
252 -
253259 /**
254260 * Returns part of an INSERT statement, corresponding to all interlanguage links to a particular site
255261 *
Index: trunk/extensions/WikimediaMaintenance/addWiki.php
@@ -171,8 +171,8 @@
172172
173173 $this->output( "Script ended. You still have to:
174174 * Add any required settings in InitialiseSettings.php
175 - * Run sync-common-all
176 - " );
 175+ * Run sync-common-all"
 176+ );
177177 }
178178
179179 private function getFirstArticle( $ucsite, $name ) {
Index: trunk/extensions/UnicodeConverter/UnicodeConverter_body.php
@@ -13,8 +13,6 @@
1414 function execute( $par ) {
1515 global $wgRequest, $wgOut;
1616
17 -
18 -
1917 $this->setHeaders();
2018
2119 $q = $wgRequest->getText( 'q' );

Status & tagging log