From: Tim Starling Date: Wed, 4 Jun 2008 01:46:53 +0000 (+0000) Subject: Use --wiki to specify the wiki ID (database name). Similar to the Wikimedia hack... X-Git-Tag: 1.31.0-rc.0~47186 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=7ce2893f687a63e3470800236bca18fb0c99e093;p=lhc%2Fweb%2Fwiklou.git 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. --- diff --git a/maintenance/commandLine.inc b/maintenance/commandLine.inc index 25f39f09fa..bc75f9ac91 100644 --- a/maintenance/commandLine.inc +++ b/maintenance/commandLine.inc @@ -37,6 +37,7 @@ if ( !isset( $optionsWithArgs ) ) { } $optionsWithArgs[] = 'conf'; # For specifying the location of LocalSettings.php $optionsWithArgs[] = 'aconf'; # As above for AdminSettings.php +$optionsWithArgs[] = 'wiki'; # For specifying the wiki ID $self = array_shift( $argv ); $IP = ( getenv('MW_INSTALL_PATH') !== false @@ -122,7 +123,11 @@ if ( file_exists( '/home/wikipedia/common/langlist' ) ) { if ( empty( $wgNoDBParam ) ) { # Check if we were passed a db name - $db = array_shift( $args ); + if ( isset( $options['wiki'] ) ) { + $db = $options['wiki']; + } else { + $db = array_shift( $args ); + } list( $site, $lang ) = $wgConf->siteFromDB( $db ); # If not, work out the language and site the old way @@ -178,6 +183,14 @@ if ( file_exists( '/home/wikipedia/common/langlist' ) ) { } else { $settingsFile = "$IP/LocalSettings.php"; } + if ( isset( $options['wiki'] ) ) { + $bits = explode( '-', $options['wiki'] ); + if ( count( $bits ) == 1 ) { + $bits[] = ''; + } + define( 'MW_DB', $bits[0] ); + define( 'MW_PREFIX', $bits[1] ); + } if ( ! is_readable( $settingsFile ) ) { print "A copy of your installation's LocalSettings.php\n" .