MediaWiki
REL1_19
|
00001 <?php 00034 $optionsWithArgs = array( 'd' ); 00035 00037 require_once( dirname( __FILE__ ) . "/commandLine.inc" ); 00038 00039 if ( isset( $options['d'] ) ) { 00040 $d = $options['d']; 00041 if ( $d > 0 ) { 00042 $wgDebugLogFile = '/dev/stdout'; 00043 } 00044 if ( $d > 1 ) { 00045 $lb = wfGetLB(); 00046 $serverCount = $lb->getServerCount(); 00047 for ( $i = 0; $i < $serverCount; $i++ ) { 00048 $server = $lb->getServerInfo( $i ); 00049 $server['flags'] |= DBO_DEBUG; 00050 $lb->setServerInfo( $i, $server ); 00051 } 00052 } 00053 if ( $d > 2 ) { 00054 $wgDebugFunctionEntry = true; 00055 } 00056 } 00057 00058 $useReadline = function_exists( 'readline_add_history' ) 00059 && Maintenance::posix_isatty( 0 /*STDIN*/ ); 00060 00061 if ( $useReadline ) { 00062 $historyFile = isset( $_ENV['HOME'] ) ? 00063 "{$_ENV['HOME']}/.mweval_history" : "$IP/maintenance/.mweval_history"; 00064 readline_read_history( $historyFile ); 00065 } 00066 00067 while ( ( $line = Maintenance::readconsole() ) !== false ) { 00068 if ( $useReadline ) { 00069 readline_add_history( $line ); 00070 readline_write_history( $historyFile ); 00071 } 00072 $val = eval( $line . ";" ); 00073 if ( wfIsHipHop() || is_null( $val ) ) { 00074 echo "\n"; 00075 } elseif ( is_string( $val ) || is_numeric( $val ) ) { 00076 echo "$val\n"; 00077 } else { 00078 var_dump( $val ); 00079 } 00080 } 00081 00082 print "\n"; 00083 00084