]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blobdiff - maintenance/eval.php
MediaWiki 1.11.0
[autoinstalls/mediawiki.git] / maintenance / eval.php
index e211830e0c9f94a6748581371a6e5d0d65577f24..519411df8c032a10619bee1c20339b3668eebb7d 100644 (file)
@@ -9,22 +9,41 @@
  * are evaluated separately, so blocks need to be input without a line break.
  * Fatal errors such as use of undeclared functions can kill the shell.
  *
- * To get decent line editing behavior, you should compile PHP with support 
+ * To get decent line editing behavior, you should compile PHP with support
  * for GNU readline (pass --with-readline to configure).
  *
- * @package MediaWiki
- * @subpackage Maintenance
+ * @addtogroup Maintenance
  */
 
 $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";
@@ -36,9 +55,8 @@ while ( $line !== false ) {
        if ( function_exists( "readline_add_history" ) ) {
                readline_add_history( $line );
        }
-       $line = readconsole( "> " );
 }
 
 print "\n";
 
-?>
+