r9621 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r9620‎ | r9621 | r9622 >
Date:22:27, 24 June 2005
Author:timstarling
Status:old
Tags:
Comment:
updated for 1.5
Modified paths:
  • /trunk/phase3/maintenance/rebuildInterwiki.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/rebuildInterwiki.inc
@@ -9,11 +9,7 @@
1010 */
1111
1212 /** */
13 -$oldCwd = getcwd();
1413
15 -$optionsWithArgs = array( "o" );
16 -include_once( "commandLine.inc" );
17 -
1814 /**
1915 * @todo document
2016 * @package MediaWiki
@@ -34,14 +30,15 @@
3531 }
3632
3733 function getRebuildInterwikiSQL() {
38 - global $langlist, $languageAliases;
 34+ global $langlist, $languageAliases, $wgDBname;
3935
4036 # Initialise lists of wikis
4137 $sites = array(
4238 'wiki' => new Site( 'wiki', 'w', 'wikipedia.org' ),
4339 'wiktionary' => new Site( 'wiktionary', 'wikt', 'wiktionary.org' ),
4440 'wikiquote' => new Site( 'wikiquote', 'q', 'wikiquote.org' ),
45 - 'wikibooks' => new Site( 'wikibooks', 'b', 'wikibooks.org' )
 41+ 'wikibooks' => new Site( 'wikibooks', 'b', 'wikibooks.org' ),
 42+ 'wikinews' => new Site( 'wikinews', 'n', 'wikinews.org' ),
4643 );
4744 $langlist = array_map( "trim", file( "/home/wikipedia/common/langlist" ) );
4845 $dblist = array_map( "trim", file( "/home/wikipedia/common/all.dblist" ) );
@@ -64,6 +61,7 @@
6562 'zh-cn' => 'zh',
6663 'zh-tw' => 'zh',
6764 'dk' => 'da',
 65+ 'nb' => 'no',
6866 );
6967
7068 # Construct a list of reserved prefixes
@@ -79,15 +77,12 @@
8078 }
8179
8280 # Extract the intermap from meta
83 - $dbr =& wfGetDB( DB_WRITE );
84 - $row = $dbr->selectRow( "metawiki.cur", array( "cur_text" ),
85 - array( "cur_namespace" => 0, "cur_title" => "Interwiki_map" ) );
 81+ $lines = file( 'http://meta.wikimedia.org/w/index.php?title=Interwiki_map&action=raw' );
8682
87 - if ( !$row ) {
 83+ if ( !$lines ) {
8884 die( "m:Interwiki_map not found" );
8985 }
9086
91 - $lines = explode( "\n", $row->cur_text );
9287 $iwArray = array();
9388
9489 foreach ( $lines as $line ) {
@@ -101,7 +96,7 @@
10297 }
10398
10499 if ( empty( $reserved[$prefix] ) ) {
105 - $iwArray[] = array( "iw_prefix" => $prefix, "iw_url" => $url, "iw_local" => $local );
 100+ $iwArray[$prefix] = array( "iw_prefix" => $prefix, "iw_url" => $url, "iw_local" => $local );
106101 }
107102 }
108103 }
@@ -229,7 +224,8 @@
230225 } else {
231226 $sql .= ",\n";
232227 }
233 - $sql .= "(" . Database::makeList( $entry ) . ")";
 228+ $dbr =& wfGetDB( DB_SLAVE );
 229+ $sql .= "(" . $dbr->makeList( $entry ) . ")";
234230 return $sql;
235231 }
236232

Status & tagging log