Index: trunk/extensions/WikimediaMaintenance/dumpInterwiki.php |
— | — | @@ -127,6 +127,10 @@ |
128 | 128 | foreach ( $this->languageAliases as $alias => $lang ) { |
129 | 129 | $reserved[$alias] = 1; |
130 | 130 | } |
| 131 | + |
| 132 | + /** |
| 133 | + * @var $site WMFSite |
| 134 | + */ |
131 | 135 | foreach ( $sites as $site ) { |
132 | 136 | $reserved[$site->lateral] = 1; |
133 | 137 | } |
— | — | @@ -174,6 +178,9 @@ |
175 | 179 | |
176 | 180 | $this->makeLink( array( 'iw_prefix' => $db, 'iw_url' => "wiki" ), "__sites" ); |
177 | 181 | # Links to multilanguage sites |
| 182 | + /** |
| 183 | + * @var $targetSite WMFSite |
| 184 | + */ |
178 | 185 | foreach ( $sites as $targetSite ) { |
179 | 186 | $this->makeLink( array( 'iw_prefix' => $targetSite->lateral, |
180 | 187 | 'iw_url' => $targetSite->getURL( 'en', $this->urlprotocol ), |
— | — | @@ -186,6 +193,7 @@ |
187 | 194 | list( $site, $lang ) = $siteOverrides[$db]; |
188 | 195 | $site = $sites[$site]; |
189 | 196 | } else { |
| 197 | + $matches = array(); |
190 | 198 | foreach ( $sites as $candidateSite ) { |
191 | 199 | $suffix = $candidateSite->suffix; |
192 | 200 | if ( preg_match( "/(.*)$suffix$/", $db, $matches ) ) { |
— | — | @@ -238,7 +246,7 @@ |
239 | 247 | /** |
240 | 248 | * Executes part of an INSERT statement, corresponding to all interlanguage links to a particular site |
241 | 249 | * |
242 | | - * @param $site |
| 250 | + * @param $site WMFSite |
243 | 251 | * @param $source |
244 | 252 | */ |
245 | 253 | function makeLanguageLinks( &$site, $source ) { |
— | — | @@ -269,6 +277,12 @@ |
270 | 278 | array_key_exists( $entry['iw_prefix'], $this->prefixRewrites[$source] ) ) { |
271 | 279 | $entry['iw_prefix'] = $this->prefixRewrites[$source][$entry['iw_prefix']]; |
272 | 280 | } |
| 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 | + } |
273 | 287 | if ( $this->dbFile ) { |
274 | 288 | $this->dbFile->set( "{$source}:{$entry['iw_prefix']}", trim( "{$entry['iw_local']} {$entry['iw_url']}" ) ); |
275 | 289 | } else { |