From d040228c88d5517c8a8f199237eb0bbe0e71ca98 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 24 Jun 2005 22:27:58 +0000 Subject: [PATCH] updated for 1.5 --- maintenance/rebuildInterwiki.inc | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/maintenance/rebuildInterwiki.inc b/maintenance/rebuildInterwiki.inc index e102bb07d9..76ef6ffd62 100644 --- a/maintenance/rebuildInterwiki.inc +++ b/maintenance/rebuildInterwiki.inc @@ -9,10 +9,6 @@ */ /** */ -$oldCwd = getcwd(); - -$optionsWithArgs = array( "o" ); -include_once( "commandLine.inc" ); /** * @todo document @@ -34,14 +30,15 @@ class Site { } function getRebuildInterwikiSQL() { - global $langlist, $languageAliases; + global $langlist, $languageAliases, $wgDBname; # Initialise lists of wikis $sites = array( 'wiki' => new Site( 'wiki', 'w', 'wikipedia.org' ), 'wiktionary' => new Site( 'wiktionary', 'wikt', 'wiktionary.org' ), 'wikiquote' => new Site( 'wikiquote', 'q', 'wikiquote.org' ), - 'wikibooks' => new Site( 'wikibooks', 'b', 'wikibooks.org' ) + 'wikibooks' => new Site( 'wikibooks', 'b', 'wikibooks.org' ), + 'wikinews' => new Site( 'wikinews', 'n', 'wikinews.org' ), ); $langlist = array_map( "trim", file( "/home/wikipedia/common/langlist" ) ); $dblist = array_map( "trim", file( "/home/wikipedia/common/all.dblist" ) ); @@ -64,6 +61,7 @@ function getRebuildInterwikiSQL() { 'zh-cn' => 'zh', 'zh-tw' => 'zh', 'dk' => 'da', + 'nb' => 'no', ); # Construct a list of reserved prefixes @@ -79,15 +77,12 @@ function getRebuildInterwikiSQL() { } # Extract the intermap from meta - $dbr =& wfGetDB( DB_WRITE ); - $row = $dbr->selectRow( "metawiki.cur", array( "cur_text" ), - array( "cur_namespace" => 0, "cur_title" => "Interwiki_map" ) ); + $lines = file( 'http://meta.wikimedia.org/w/index.php?title=Interwiki_map&action=raw' ); - if ( !$row ) { + if ( !$lines ) { die( "m:Interwiki_map not found" ); } - $lines = explode( "\n", $row->cur_text ); $iwArray = array(); foreach ( $lines as $line ) { @@ -101,7 +96,7 @@ function getRebuildInterwikiSQL() { } if ( empty( $reserved[$prefix] ) ) { - $iwArray[] = array( "iw_prefix" => $prefix, "iw_url" => $url, "iw_local" => $local ); + $iwArray[$prefix] = array( "iw_prefix" => $prefix, "iw_url" => $url, "iw_local" => $local ); } } } @@ -229,7 +224,8 @@ function makeLink( $entry, &$first ) { } else { $sql .= ",\n"; } - $sql .= "(" . Database::makeList( $entry ) . ")"; + $dbr =& wfGetDB( DB_SLAVE ); + $sql .= "(" . $dbr->makeList( $entry ) . ")"; return $sql; } -- 2.20.1