rdbms: reduce LoadBalancer replication log spam
[lhc/web/wiklou.git] / maintenance / mcc.php
index 6ff8a17..784ba0e 100644 (file)
  * @ingroup Maintenance
  */
 
-/** */
-require_once( __DIR__ . '/commandLine.inc' );
-
-$options = getopt( '', array( 'debug', 'help', 'cache:' ) );
+$optionsWithArgs = [ 'cache' ];
+$optionsWithoutArgs = [
+       'debug', 'help'
+];
+require_once __DIR__ . '/commandLine.inc';
 
 $debug = isset( $options['debug'] );
 $help = isset( $options['help'] );
@@ -35,10 +36,10 @@ if ( $help ) {
        mccShowUsage();
        exit( 0 );
 }
-$mcc = new MWMemcached( array(
+$mcc = new MemcachedClient( [
        'persistent' => true,
        'debug' => $debug,
-) );
+] );
 
 if ( $cache ) {
        if ( !isset( $wgObjectCaches[$cache] ) ) {
@@ -48,7 +49,7 @@ if ( $cache ) {
        $servers = $wgObjectCaches[$cache]['servers'];
 } elseif ( $wgMainCacheType === CACHE_MEMCACHED ) {
        $mcc->set_servers( $wgMemCachedServers );
-} elseif( isset( $wgObjectCaches[$wgMainCacheType]['servers'] ) ) {
+} elseif ( isset( $wgObjectCaches[$wgMainCacheType]['servers'] ) ) {
        $mcc->set_servers( $wgObjectCaches[$wgMainCacheType]['servers'] );
 } else {
        print "MediaWiki isn't configured for Memcached usage\n";
@@ -81,7 +82,7 @@ EOF;
 
 function mccGetHelp( $command ) {
        $output = '';
-       $commandList = array(
+       $commandList = [
                'get' => 'grabs something',
                'getsock' => 'lists sockets',
                'set' => 'changes something',
@@ -92,7 +93,7 @@ function mccGetHelp( $command ) {
                'exit' => 'exit mcc',
                'quit' => 'exit mcc',
                'help' => 'help about a command',
-       );
+       ];
        if ( !$command ) {
                $command = 'fullhelp';
        }
@@ -116,7 +117,9 @@ do {
        $quit = false;
 
        $line = Maintenance::readconsole();
-       if ( $line === false ) exit;
+       if ( $line === false ) {
+               exit;
+       }
 
        $args = explode( ' ', $line );
        $command = array_shift( $args );