X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fshell.php;h=c8a8a4527fa4f524e53bb5ef923a4ee7ce53f86b;hb=de69db1e2263bf613a7b5c3d60b2661e776df0e4;hp=5df5b54f874ddf94e4ae9e6810b2230dfeb13c2f;hpb=6f466c166e3ba5ea8f2e1a37bc32d3c02901c3e0;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/shell.php b/maintenance/shell.php index 5df5b54f87..c8a8a4527f 100644 --- a/maintenance/shell.php +++ b/maintenance/shell.php @@ -36,6 +36,7 @@ use MediaWiki\Logger\LoggerFactory; use MediaWiki\Logger\ConsoleSpi; +use MediaWiki\MediaWikiServices; require_once __DIR__ . '/Maintenance.php'; @@ -57,7 +58,7 @@ class MediaWikiShell extends Maintenance { public function execute() { if ( !class_exists( \Psy\Shell::class ) ) { - $this->error( 'PsySH not found. Please run composer with the --dev option.', 1 ); + $this->fatalError( 'PsySH not found. Please run composer with the --dev option.' ); } $traverser = new \PhpParser\NodeTraverser(); @@ -83,21 +84,17 @@ class MediaWikiShell extends Maintenance { $d = intval( $this->getOption( 'd' ) ); if ( $d > 0 ) { 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 ); } } } -$maintClass = 'MediaWikiShell'; +$maintClass = MediaWikiShell::class; require_once RUN_MAINTENANCE_IF_MAIN;