00001 <?php
00019 $wgUseNormalUser = (bool)getenv('MW_WIKIUSER');
00020
00021 $optionsWithArgs = array( 'd' );
00022
00024 require_once( "commandLine.inc" );
00025
00026 if ( isset( $options['d'] ) ) {
00027 $d = $options['d'];
00028 if ( $d > 0 ) {
00029 $wgDebugLogFile = '/dev/stdout';
00030 }
00031 if ( $d > 1 ) {
00032 $lb = wfGetLB();
00033 foreach ( $lb->mServers as $i => $server ) {
00034 $lb->mServers[$i]['flags'] |= DBO_DEBUG;
00035 }
00036 }
00037 if ( $d > 2 ) {
00038 $wgDebugFunctionEntry = true;
00039 }
00040 }
00041
00042 if ( function_exists( 'readline_add_history' )
00043 && function_exists( 'posix_isatty' ) && posix_isatty( 0 ) )
00044 {
00045 $useReadline = true;
00046 } else {
00047 $useReadline = false;
00048 }
00049
00050 if ( $useReadline ) {
00051 $historyFile = "{$_ENV['HOME']}/.mweval_history";
00052 readline_read_history( $historyFile );
00053 }
00054
00055 while ( ( $line = readconsole( '> ' ) ) !== false ) {
00056 if ( $useReadline ) {
00057 readline_add_history( $line );
00058 readline_write_history( $historyFile );
00059 }
00060 $val = eval( $line . ";" );
00061 if( is_null( $val ) ) {
00062 echo "\n";
00063 } elseif( is_string( $val ) || is_numeric( $val ) ) {
00064 echo "$val\n";
00065 } else {
00066 var_dump( $val );
00067 }
00068 }
00069
00070 print "\n";
00071
00072