r110487 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110486‎ | r110487 | r110488 >
Date:15:46, 1 February 2012
Author:reedy
Status:ok
Tags:
Comment:
Followup r110454, quieten script by setting default values for non set iw_url/iw_local

Needs some further work to work out why it is not set
Modified paths:
  • /trunk/extensions/WikimediaMaintenance/dumpInterwiki.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikimediaMaintenance/dumpInterwiki.php
@@ -127,6 +127,10 @@
128128 foreach ( $this->languageAliases as $alias => $lang ) {
129129 $reserved[$alias] = 1;
130130 }
 131+
 132+ /**
 133+ * @var $site WMFSite
 134+ */
131135 foreach ( $sites as $site ) {
132136 $reserved[$site->lateral] = 1;
133137 }
@@ -174,6 +178,9 @@
175179
176180 $this->makeLink( array( 'iw_prefix' => $db, 'iw_url' => "wiki" ), "__sites" );
177181 # Links to multilanguage sites
 182+ /**
 183+ * @var $targetSite WMFSite
 184+ */
178185 foreach ( $sites as $targetSite ) {
179186 $this->makeLink( array( 'iw_prefix' => $targetSite->lateral,
180187 'iw_url' => $targetSite->getURL( 'en', $this->urlprotocol ),
@@ -186,6 +193,7 @@
187194 list( $site, $lang ) = $siteOverrides[$db];
188195 $site = $sites[$site];
189196 } else {
 197+ $matches = array();
190198 foreach ( $sites as $candidateSite ) {
191199 $suffix = $candidateSite->suffix;
192200 if ( preg_match( "/(.*)$suffix$/", $db, $matches ) ) {
@@ -238,7 +246,7 @@
239247 /**
240248 * Executes part of an INSERT statement, corresponding to all interlanguage links to a particular site
241249 *
242 - * @param $site
 250+ * @param $site WMFSite
243251 * @param $source
244252 */
245253 function makeLanguageLinks( &$site, $source ) {
@@ -269,6 +277,12 @@
270278 array_key_exists( $entry['iw_prefix'], $this->prefixRewrites[$source] ) ) {
271279 $entry['iw_prefix'] = $this->prefixRewrites[$source][$entry['iw_prefix']];
272280 }
 281+ if ( !array_key_exists( "iw_local", $entry ) ) {
 282+ $entry["iw_local"] = 0;
 283+ }
 284+ if ( !array_key_exists( "iw_url", $entry ) ) {
 285+ $entry["iw_url"] = '';
 286+ }
273287 if ( $this->dbFile ) {
274288 $this->dbFile->set( "{$source}:{$entry['iw_prefix']}", trim( "{$entry['iw_local']} {$entry['iw_url']}" ) );
275289 } else {

Follow-up revisions

RevisionCommit summaryAuthorDate
r110490Merge quietening part of r110487reedy15:52, 1 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r110454Revert part of r109617...reedy01:09, 1 February 2012

Status & tagging log