Merge "Pass database connection to SpecialWatchlist::countItems"
[lhc/web/wiklou.git] / maintenance / eval.php
index 74143b5..69cf548 100644 (file)
  * @ingroup Maintenance
  */
 
-$wgUseNormalUser = (bool)getenv( 'MW_WIKIUSER' );
-
 $optionsWithArgs = array( 'd' );
 
 /** */
-require_once( "commandLine.inc" );
+require_once( __DIR__ . "/commandLine.inc" );
 
 if ( isset( $options['d'] ) ) {
        $d = $options['d'];
@@ -45,8 +43,11 @@ if ( isset( $options['d'] ) ) {
        }
        if ( $d > 1 ) {
                $lb = wfGetLB();
-               foreach ( $lb->mServers as $i => $server ) {
-                       $lb->mServers[$i]['flags'] |= DBO_DEBUG;
+               $serverCount = $lb->getServerCount();
+               for ( $i = 0; $i < $serverCount; $i++ ) {
+                       $server = $lb->getServerInfo( $i );
+                       $server['flags'] |= DBO_DEBUG;
+                       $lb->setServerInfo( $i, $server );
                }
        }
        if ( $d > 2 ) {
@@ -54,13 +55,8 @@ if ( isset( $options['d'] ) ) {
        }
 }
 
-if ( function_exists( 'readline_add_history' )
-       && posix_isatty( 0 /*STDIN*/ ) )
-{
-       $useReadline = true;
-} else {
-       $useReadline = false;
-}
+$useReadline = function_exists( 'readline_add_history' )
+                       && Maintenance::posix_isatty( 0 /*STDIN*/ );
 
 if ( $useReadline ) {
        $historyFile = isset( $_ENV['HOME'] ) ?