Index: trunk/phase3/maintenance/mcc.php |
— | — | @@ -8,8 +8,8 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | /** */ |
12 | | -require_once( "commandLine.inc" ); |
13 | | -require_once("memcached-client.php"); |
| 12 | +require_once( 'commandLine.inc' ); |
| 13 | +require_once( 'memcached-client.php' ); |
14 | 14 | |
15 | 15 | $mcc = new memcached( array('persistant' => true, 'debug' => true) ); |
16 | 16 | $mcc->set_servers( $wgMemCachedServers ); |
— | — | @@ -18,12 +18,16 @@ |
19 | 19 | do { |
20 | 20 | $bad = false; |
21 | 21 | $quit = false; |
22 | | - $line = readconsole( "> " ); |
| 22 | + |
| 23 | + $line = readconsole( '> ' ); |
23 | 24 | if ($line === false) exit; |
24 | | - $args = explode( " ", $line ); |
| 25 | + |
| 26 | + $args = explode( ' ', $line ); |
25 | 27 | $command = array_shift( $args ); |
| 28 | + |
26 | 29 | switch ( $command ) { |
27 | | - case "get": |
| 30 | + |
| 31 | + case 'get': |
28 | 32 | print "Getting {$args[0]}[{$args[1]}]\n"; |
29 | 33 | $res = $mcc->get( $args[0] ); |
30 | 34 | if ( array_key_exists( 1, $args ) ) { |
— | — | @@ -38,37 +42,43 @@ |
39 | 43 | var_dump( $res ); |
40 | 44 | } |
41 | 45 | break; |
42 | | - case "getsock": |
| 46 | + |
| 47 | + case 'getsock': |
43 | 48 | $res = $mcc->get( $args[0] ); |
44 | 49 | $sock = $mcc->get_sock( $args[0] ); |
45 | 50 | var_dump( $sock ); |
46 | 51 | break; |
47 | | - case "set": |
| 52 | + |
| 53 | + case 'set': |
48 | 54 | $key = array_shift( $args ); |
49 | 55 | if ( $args[0] == "#" && is_numeric( $args[1] ) ) { |
50 | | - $value = str_repeat( "*", $args[1] ); |
| 56 | + $value = str_repeat( '*', $args[1] ); |
51 | 57 | } else { |
52 | | - $value = implode( " ", $args ); |
| 58 | + $value = implode( ' ', $args ); |
53 | 59 | } |
54 | 60 | if ( !$mcc->set( $key, $value, 0 ) ) { |
55 | 61 | #print 'Error: ' . $mcc->error_string() . "\n"; |
56 | 62 | print "MemCached error\n"; |
57 | 63 | } |
58 | 64 | break; |
59 | | - case "delete": |
60 | | - $key = implode( " ", $args ); |
| 65 | + |
| 66 | + case 'delete': |
| 67 | + $key = implode( ' ', $args ); |
61 | 68 | if ( !$mcc->delete( $key ) ) { |
62 | 69 | #print 'Error: ' . $mcc->error_string() . "\n"; |
63 | 70 | print "MemCached error\n"; |
64 | 71 | } |
65 | | - break; |
66 | | - case "dumpmcc": |
| 72 | + break; |
| 73 | + |
| 74 | + case 'dumpmcc': |
67 | 75 | var_dump( $mcc ); |
68 | 76 | break; |
69 | | - case "quit": |
70 | | - case "exit": |
| 77 | + |
| 78 | + case 'quit': |
| 79 | + case 'exit': |
71 | 80 | $quit = true; |
72 | 81 | break; |
| 82 | + |
73 | 83 | default: |
74 | 84 | $bad = true; |
75 | 85 | } |
— | — | @@ -77,7 +87,7 @@ |
78 | 88 | print "Bad command\n"; |
79 | 89 | } |
80 | 90 | } else { |
81 | | - if ( function_exists( "readline_add_history" ) ) { |
| 91 | + if ( function_exists( 'readline_add_history' ) ) { |
82 | 92 | readline_add_history( $line ); |
83 | 93 | } |
84 | 94 | } |