X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Feval.php;h=40d29ef87c941474bd015b1b35f6ab9b1e6493c3;hb=801a8bdaa38cea5ff4db0440c82e9eb83e083772;hp=3f10a33b516399dcadf88bb84d1c4ce9d32d30e1;hpb=a3eb5b3a8cf2414964858797ada3551895484ade;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/eval.php b/maintenance/eval.php index 3f10a33b51..40d29ef87c 100644 --- a/maintenance/eval.php +++ b/maintenance/eval.php @@ -30,24 +30,24 @@ * @ingroup Maintenance */ -$optionsWithArgs = array( 'd' ); +use MediaWiki\Logger\LoggerFactory; +use MediaWiki\Logger\ConsoleSpi; +use MediaWiki\MediaWikiServices; + +$optionsWithArgs = [ 'd' ]; -/** */ require_once __DIR__ . "/commandLine.inc"; if ( isset( $options['d'] ) ) { $d = $options['d']; if ( $d > 0 ) { - $wgDebugLogFile = '/dev/stdout'; + LoggerFactory::registerProvider( new ConsoleSpi ); + // Some services hold Logger instances in object properties + MediaWikiServices::resetGlobalInstance(); } if ( $d > 1 ) { - $lb = wfGetLB(); - $serverCount = $lb->getServerCount(); - for ( $i = 0; $i < $serverCount; $i++ ) { - $server = $lb->getServerInfo( $i ); - $server['flags'] |= DBO_DEBUG; - $lb->setServerInfo( $i, $server ); - } + wfGetDB( DB_MASTER )->setFlag( DBO_DEBUG ); + wfGetDB( DB_REPLICA )->setFlag( DBO_DEBUG ); } } @@ -60,11 +60,6 @@ if ( $__useReadline ) { readline_read_history( $__historyFile ); } -$__phpPath = preg_match( '/Zend Engine|HipHop VM/', wfShellExecWithStderr( 'php --version' ) ) - ? 'php' //standard system path name - : ''; // not accessible somehow - -$__multiLine = ''; $__e = null; // PHP exception while ( ( $__line = Maintenance::readconsole() ) !== false ) { if ( $__e && !preg_match( '/^(exit|die);?$/', $__line ) ) { @@ -79,18 +74,8 @@ while ( ( $__line = Maintenance::readconsole() ) !== false ) { readline_add_history( $__line ); readline_write_history( $__historyFile ); } - // Try to only run PHP once a valid chunk is formed (deals with newlines) - if ( $__phpPath ) { - $res = wfShellExecWithStderr( - "echo " . wfEscapeShellArg( "getMessage()}\n" . $__e->getTraceAsString() . "\n";