* Two special pages had the same description, meaning that only one showed up
[lhc/web/wiklou.git] / maintenance / eval.php
index ec09bc8..21d7ee5 100755 (executable)
  */
 
 $wgForceLoadBalancing = (getenv('MW_BALANCE') ? true : false);
+$wgUseNormalUser = (getenv('MW_WIKIUSER') ? true : false);
+if (getenv('MW_PROFILING')) {
+       define('MW_CMDLINE_CALLBACK', 'wfSetProfiling');
+}
+function wfSetProfiling() { $GLOBALS['wgProfiling'] = true; }
+
+$optionsWithArgs = array( 'd' );
 
 /** */
 require_once( "commandLine.inc" );
 
-$line = readconsole( "> " );
+if ( isset( $options['d'] ) ) {
+       $d = $options['d'];
+       if ( $d > 0 ) {
+               $wgDebugLogFile = '/dev/stdout';
+       }
+       if ( $d > 1 ) {
+               foreach ( $wgLoadBalancer->mServers as $i => $server ) {
+                       $wgLoadBalancer->mServers[$i]['flags'] |= DBO_DEBUG;
+               }
+       }
+       if ( $d > 2 ) {
+               $wgDebugFunctionEntry = true;
+       }
+}
+
 
-while ( $line !== false ) {
+while ( ( $line = readconsole( '> ' ) ) !== false ) {
        $val = eval( $line . ";" );
        if( is_null( $val ) ) {
                echo "\n";
@@ -35,7 +56,6 @@ while ( $line !== false ) {
        if ( function_exists( "readline_add_history" ) ) {
                readline_add_history( $line );
        }
-       $line = readconsole( "> " );
 }
 
 print "\n";