r9619 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r9618‎ | r9619 | r9620 >
Date:21:39, 24 June 2005
Author:timstarling
Status:old
Tags:
Comment:
updated rebuildInterwiki
Modified paths:
  • /branches/REL1_4/phase3/maintenance/commandLine.inc (modified) (history)
  • /branches/REL1_4/phase3/maintenance/rebuildInterwiki.inc (modified) (history)

Diff [purge]

Index: branches/REL1_4/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
@@ -41,7 +37,8 @@
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,8 +77,8 @@
8078 }
8179
8280 # Extract the intermap from meta
83 - $dbr =& wfGetDB( DB_WRITE );
84 - $row = $dbr->selectRow( "metawiki.cur", array( "cur_text" ),
 81+ $dbr =& wfGetDB( DB_SLAVE );
 82+ $row = $dbr->selectRow( "`metawiki`.cur", array( "cur_text" ),
8583 array( "cur_namespace" => 0, "cur_title" => "Interwiki_map" ) );
8684
8785 if ( !$row ) {
@@ -101,7 +99,7 @@
102100 }
103101
104102 if ( empty( $reserved[$prefix] ) ) {
105 - $iwArray[] = array( "iw_prefix" => $prefix, "iw_url" => $url, "iw_local" => $local );
 103+ $iwArray[$prefix] = array( "iw_prefix" => $prefix, "iw_url" => $url, "iw_local" => $local );
106104 }
107105 }
108106 }
@@ -229,7 +227,8 @@
230228 } else {
231229 $sql .= ",\n";
232230 }
233 - $sql .= "(" . Database::makeList( $entry ) . ")";
 231+ $dbr =& wfGetDB( DB_SLAVE );
 232+ $sql .= "(" . $dbr->makeList( $entry ) . ")";
234233 return $sql;
235234 }
236235
Index: branches/REL1_4/phase3/maintenance/commandLine.inc
@@ -88,22 +88,27 @@
8989 # Get $conf
9090 require( "$IP/InitialiseSettings.php" );
9191
92 - # Check if we were passed a db name
93 - $db = array_shift( $args );
94 - list( $site, $lang ) = $conf->siteFromDB( $db );
 92+ if ( empty( $wgNoDBParam ) ) {
 93+ # Check if we were passed a db name
 94+ $db = array_shift( $args );
 95+ list( $site, $lang ) = $conf->siteFromDB( $db );
9596
96 - # If not, work out the language and site the old way
97 - if ( is_null( $site ) || is_null( $lang ) ) {
98 - if ( !$db ) {
99 - $lang = "aa";
100 - } else {
101 - $lang = $db;
 97+ # If not, work out the language and site the old way
 98+ if ( is_null( $site ) || is_null( $lang ) ) {
 99+ if ( !$db ) {
 100+ $lang = "aa";
 101+ } else {
 102+ $lang = $db;
 103+ }
 104+ if ( isset( $args[0] ) ) {
 105+ $site = array_shift( $args );
 106+ } else {
 107+ $site = "wikipedia";
 108+ }
102109 }
103 - if ( isset( $args[0] ) ) {
104 - $site = array_shift( $args );
105 - } else {
106 - $site = "wikipedia";
107 - }
 110+ } else {
 111+ $lang = "aa";
 112+ $site = "wikipedia";
108113 }
109114
110115 # This is for the IRC scripts, which now run as the apache user

Status & tagging log