r11926 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r11925‎ | r11926 | r11927 >
Date:17:41, 3 December 2005
Author:hashar
Status:old
Tags:
Comment:
dumb help messages. FIXME
Modified paths:
  • /trunk/phase3/maintenance/mcc.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/mcc.php
@@ -15,8 +15,56 @@
1616 $mcc->set_servers( $wgMemCachedServers );
1717 $mcc->set_debug( true );
1818
 19+function mccShowHelp($command) {
 20+
 21+ if(! $command ) { $command = 'fullhelp'; }
 22+ $onlyone = true;
 23+
 24+ switch ( $command ) {
 25+
 26+ case 'fullhelp':
 27+ // will show help for all commands
 28+ $onlyone = false;
 29+
 30+ case 'get':
 31+ print "get: grabs something\n";
 32+ if($onlyone) { break; }
 33+
 34+ case 'getsock':
 35+ print "getsock: lists sockets\n";
 36+ if($onlyone) { break; }
 37+
 38+ case 'set':
 39+ print "set: changes something\n";
 40+ if($onlyone) { break; }
 41+
 42+ case 'delete':
 43+ print "delete: deletes something\n";
 44+ if($onlyone) { break; }
 45+
 46+ case 'dumpmcc':
 47+ print "dumpmcc: shows the whole thing\n";
 48+ if($onlyone) { break; }
 49+
 50+ case 'exit':
 51+ case 'quit':
 52+ print "exit or quit: exit mcc\n";
 53+ if($onlyone) { break; }
 54+
 55+ case 'help':
 56+ print "help: help about a command\n";
 57+ if($onlyone) { break; }
 58+
 59+ default:
 60+ if($onlyone) {
 61+ print "$command: command does not exist or no help for it\n";
 62+ }
 63+ }
 64+}
 65+
1966 do {
2067 $bad = false;
 68+ $showhelp = false;
2169 $quit = false;
2270
2371 $line = readconsole( '> ' );
@@ -25,7 +73,12 @@
2674 $args = explode( ' ', $line );
2775 $command = array_shift( $args );
2876
 77+ // process command
2978 switch ( $command ) {
 79+ case 'help':
 80+ // show an help message
 81+ mccShowHelp(array_shift($args));
 82+ break;
3083
3184 case 'get':
3285 print "Getting {$args[0]}[{$args[1]}]\n";
@@ -41,7 +94,7 @@
4295 } else {
4396 var_dump( $res );
4497 }
45 - break;
 98+ break;
4699
47100 case 'getsock':
48101 $res = $mcc->get( $args[0] );
@@ -81,7 +134,8 @@
82135
83136 default:
84137 $bad = true;
85 - }
 138+ } // switch() end
 139+
86140 if ( $bad ) {
87141 if ( $command ) {
88142 print "Bad command\n";

Status & tagging log