X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fshell.php;h=65c353a29e18b74a5d607e4d982b8b2498a26bce;hb=fd9c94d971dfac73f0ea5865a3df80e69cf71ea7;hp=47ef8045b13dba71662d04cc3e01a27a4a928f8b;hpb=55043101b2a89ea1e811b6d35e415f57ed0bf41d;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/shell.php b/maintenance/shell.php index 47ef8045b1..65c353a29e 100644 --- a/maintenance/shell.php +++ b/maintenance/shell.php @@ -34,6 +34,10 @@ * @author Gergő Tisza */ +use MediaWiki\Logger\LoggerFactory; +use MediaWiki\Logger\ConsoleSpi; +use MediaWiki\MediaWikiServices; + require_once __DIR__ . '/Maintenance.php'; /** @@ -46,8 +50,8 @@ class MediaWikiShell extends Maintenance { parent::__construct(); $this->addOption( 'd', 'For back compatibility with eval.php. ' . - '0 send debug to stdout. ' . - 'With 1 additionally initialize database with debugging ', + '1 send debug to stderr. ' . + 'With 2 additionally initialize database with debugging ', false, true ); } @@ -77,22 +81,16 @@ class MediaWikiShell extends Maintenance { * For back compatibility with eval.php */ protected function setupLegacy() { - global $wgDebugLogFile; - $d = intval( $this->getOption( 'd' ) ); if ( $d > 0 ) { - $wgDebugLogFile = 'php://stdout'; + LoggerFactory::registerProvider( new ConsoleSpi ); + // Some services hold Logger instances in object properties + MediaWikiServices::resetGlobalInstance(); } if ( $d > 1 ) { # Set DBO_DEBUG (equivalent of $wgDebugDumpSql) - # XXX copy pasted from eval.php :( - $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 ); } }