r35839 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35838‎ | r35839 | r35840 >
Date:01:46, 4 June 2008
Author:tstarling
Status:old
Tags:
Comment:
Use --wiki to specify the wiki ID (database name). Similar to the Wikimedia hack but applicable to all farm installations. Requires special handling in LocalSettings.php to transfer the MW_DB through to $wgDBname.
Modified paths:
  • /trunk/phase3/maintenance/commandLine.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/commandLine.inc
@@ -37,6 +37,7 @@
3838 }
3939 $optionsWithArgs[] = 'conf'; # For specifying the location of LocalSettings.php
4040 $optionsWithArgs[] = 'aconf'; # As above for AdminSettings.php
 41+$optionsWithArgs[] = 'wiki'; # For specifying the wiki ID
4142
4243 $self = array_shift( $argv );
4344 $IP = ( getenv('MW_INSTALL_PATH') !== false
@@ -122,7 +123,11 @@
123124
124125 if ( empty( $wgNoDBParam ) ) {
125126 # Check if we were passed a db name
126 - $db = array_shift( $args );
 127+ if ( isset( $options['wiki'] ) ) {
 128+ $db = $options['wiki'];
 129+ } else {
 130+ $db = array_shift( $args );
 131+ }
127132 list( $site, $lang ) = $wgConf->siteFromDB( $db );
128133
129134 # If not, work out the language and site the old way
@@ -178,6 +183,14 @@
179184 } else {
180185 $settingsFile = "$IP/LocalSettings.php";
181186 }
 187+ if ( isset( $options['wiki'] ) ) {
 188+ $bits = explode( '-', $options['wiki'] );
 189+ if ( count( $bits ) == 1 ) {
 190+ $bits[] = '';
 191+ }
 192+ define( 'MW_DB', $bits[0] );
 193+ define( 'MW_PREFIX', $bits[1] );
 194+ }
182195
183196 if ( ! is_readable( $settingsFile ) ) {
184197 print "A copy of your installation's LocalSettings.php\n" .

Status & tagging log