X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fmcc.php;h=7b7b761445264b834f7ed7192a954b8ed4051171;hb=2eea1d5a42a4b5c455b90a4ed61bf0f9c9296141;hp=4e0f291b73ffc4223b86c10b78997c59875b9bb1;hpb=588533365d867dac72c6e4b77303bbcb38487044;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/mcc.php b/maintenance/mcc.php index 4e0f291b73..7b7b761445 100644 --- a/maintenance/mcc.php +++ b/maintenance/mcc.php @@ -23,12 +23,15 @@ */ /** */ -require_once( __DIR__ . '/commandLine.inc' ); +require_once __DIR__ . '/commandLine.inc'; -$debug = in_array( '--debug', $argv ); -$help = in_array( '--help', $argv ); +$options = getopt( '', array( 'debug', 'help', 'cache:' ) ); -if( $help ) { +$debug = isset( $options['debug'] ); +$help = isset( $options['help'] ); +$cache = isset( $options['cache'] ) ? $options['cache'] : null; + +if ( $help ) { mccShowUsage(); exit( 0 ); } @@ -37,9 +40,15 @@ $mcc = new MWMemcached( array( 'debug' => $debug, ) ); -if ( $wgMainCacheType === CACHE_MEMCACHED ) { +if ( $cache ) { + if ( !isset( $wgObjectCaches[$cache] ) ) { + print "MediaWiki isn't configured with a cache named '$cache'"; + exit( 1 ); + } + $servers = $wgObjectCaches[$cache]['servers']; +} elseif ( $wgMainCacheType === CACHE_MEMCACHED ) { $mcc->set_servers( $wgMemCachedServers ); -} elseif( isset( $wgObjectCaches[$wgMainCacheType] ) ) { +} elseif ( isset( $wgObjectCaches[$wgMainCacheType]['servers'] ) ) { $mcc->set_servers( $wgObjectCaches[$wgMainCacheType]['servers'] ); } else { print "MediaWiki isn't configured for Memcached usage\n"; @@ -107,7 +116,9 @@ do { $quit = false; $line = Maintenance::readconsole(); - if ( $line === false ) exit; + if ( $line === false ) { + exit; + } $args = explode( ' ', $line ); $command = array_shift( $args );