2 include_once( "../includes/DefaultSettings.php" );
3 include_once( "../LocalSettings.php" );
4 include_once( "../includes/MemCachedClient.inc.php" );
6 $mcc = new MemCachedClient();
7 $mcc->set_servers( $wgMemCachedServers );
12 $line = readconsole( "> " );
13 $args = explode( " ", $line );
14 $command = array_shift( $args );
17 $res = $mcc->get( implode( " ", $args ) );
18 if ( $res === false ) {
19 print 'Error: ' . $mcc->error_string() . "\n";
20 } elseif ( is_string( $res ) ) {
27 $key = array_shift( $args );
28 if ( !$mcc->set( $key, implode( " ", $args ), 0 ) ) {
29 print 'Error: ' . $mcc->error_string() . "\n";
40 print "Bad command\n";
43 if ( function_exists( "readline_add_history" ) ) {
44 readline_add_history( $line );
49 function readconsole( $prompt = "" ) {
50 if ( function_exists( "readline" ) ) {
51 return readline( $prompt );
54 $fp = fopen( "php://stdin", "r" );
55 $resp = trim( fgets( $fp, 1024 ) );