Index: trunk/phase3/maintenance/rebuildInterwiki.inc |
— | — | @@ -9,11 +9,7 @@ |
10 | 10 | */ |
11 | 11 | |
12 | 12 | /** */ |
13 | | -$oldCwd = getcwd(); |
14 | 13 | |
15 | | -$optionsWithArgs = array( "o" ); |
16 | | -include_once( "commandLine.inc" ); |
17 | | - |
18 | 14 | /** |
19 | 15 | * @todo document |
20 | 16 | * @package MediaWiki |
— | — | @@ -34,14 +30,15 @@ |
35 | 31 | } |
36 | 32 | |
37 | 33 | function getRebuildInterwikiSQL() { |
38 | | - global $langlist, $languageAliases; |
| 34 | + global $langlist, $languageAliases, $wgDBname; |
39 | 35 | |
40 | 36 | # Initialise lists of wikis |
41 | 37 | $sites = array( |
42 | 38 | 'wiki' => new Site( 'wiki', 'w', 'wikipedia.org' ), |
43 | 39 | 'wiktionary' => new Site( 'wiktionary', 'wikt', 'wiktionary.org' ), |
44 | 40 | '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' ), |
46 | 43 | ); |
47 | 44 | $langlist = array_map( "trim", file( "/home/wikipedia/common/langlist" ) ); |
48 | 45 | $dblist = array_map( "trim", file( "/home/wikipedia/common/all.dblist" ) ); |
— | — | @@ -64,6 +61,7 @@ |
65 | 62 | 'zh-cn' => 'zh', |
66 | 63 | 'zh-tw' => 'zh', |
67 | 64 | 'dk' => 'da', |
| 65 | + 'nb' => 'no', |
68 | 66 | ); |
69 | 67 | |
70 | 68 | # Construct a list of reserved prefixes |
— | — | @@ -79,15 +77,12 @@ |
80 | 78 | } |
81 | 79 | |
82 | 80 | # 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' ); |
86 | 82 | |
87 | | - if ( !$row ) { |
| 83 | + if ( !$lines ) { |
88 | 84 | die( "m:Interwiki_map not found" ); |
89 | 85 | } |
90 | 86 | |
91 | | - $lines = explode( "\n", $row->cur_text ); |
92 | 87 | $iwArray = array(); |
93 | 88 | |
94 | 89 | foreach ( $lines as $line ) { |
— | — | @@ -101,7 +96,7 @@ |
102 | 97 | } |
103 | 98 | |
104 | 99 | 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 ); |
106 | 101 | } |
107 | 102 | } |
108 | 103 | } |
— | — | @@ -229,7 +224,8 @@ |
230 | 225 | } else { |
231 | 226 | $sql .= ",\n"; |
232 | 227 | } |
233 | | - $sql .= "(" . Database::makeList( $entry ) . ")"; |
| 228 | + $dbr =& wfGetDB( DB_SLAVE ); |
| 229 | + $sql .= "(" . $dbr->makeList( $entry ) . ")"; |
234 | 230 | return $sql; |
235 | 231 | } |
236 | 232 | |