X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fstorage%2FrecompressTracked.php;h=8a8f4d81bf7c123784ed132dd827e49efd9f7457;hb=7710afe5690b76a4161b9c040f81be340384e8c6;hp=7f89ce9e6e1c96c6a810bf7ee6d1f6f8e3aee192;hpb=8b9143e121236281b9850435131234f2d4dc3e34;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/storage/recompressTracked.php b/maintenance/storage/recompressTracked.php index 7f89ce9e6e..8a8f4d81bf 100644 --- a/maintenance/storage/recompressTracked.php +++ b/maintenance/storage/recompressTracked.php @@ -24,6 +24,7 @@ use MediaWiki\Logger\LegacyLogger; use MediaWiki\MediaWikiServices; +use MediaWiki\Shell\Shell; use Wikimedia\Rdbms\IDatabase; $optionsWithArgs = RecompressTracked::getOptionsWithArgs(); @@ -68,6 +69,7 @@ class RecompressTracked { public $replicaId = false; public $noCount = false; public $debugLog, $infoLog, $criticalLog; + /** @var ExternalStoreDB */ public $store; private static $optionsWithArgs = [ @@ -108,7 +110,8 @@ class RecompressTracked { foreach ( $options as $name => $value ) { $this->$name = $value; } - $this->store = new ExternalStoreDB; + $esFactory = MediaWikiServices::getInstance()->getExternalStoreFactory(); + $this->store = $esFactory->getStore( 'DB' ); if ( !$this->isChild ) { $GLOBALS['wgDebugLogPrefix'] = "RCT M: "; } elseif ( $this->replicaId !== false ) { @@ -145,7 +148,7 @@ class RecompressTracked { if ( $this->replicaId !== false ) { $header .= "({$this->replicaId})"; } - $header .= ' ' . wfWikiID(); + $header .= ' ' . WikiMap::getCurrentWikiDbDomain()->getId(); LegacyLogger::emit( sprintf( "%-50s %s\n", $header, $msg ), $file ); } @@ -215,19 +218,19 @@ class RecompressTracked { * writing are all slow. */ function startReplicaProcs() { - $cmd = 'php ' . wfEscapeShellArg( __FILE__ ); + $cmd = 'php ' . Shell::escape( __FILE__ ); foreach ( self::$cmdLineOptionMap as $cmdOption => $classOption ) { if ( $cmdOption == 'replica-id' ) { continue; } elseif ( in_array( $cmdOption, self::$optionsWithArgs ) && isset( $this->$classOption ) ) { - $cmd .= " --$cmdOption " . wfEscapeShellArg( $this->$classOption ); + $cmd .= " --$cmdOption " . Shell::escape( $this->$classOption ); } elseif ( $this->$classOption ) { $cmd .= " --$cmdOption"; } } $cmd .= ' --child' . - ' --wiki ' . wfEscapeShellArg( wfWikiID() ) . - ' ' . wfEscapeShellArg( ...$this->destClusters ); + ' --wiki ' . Shell::escape( wfWikiID() ) . + ' ' . Shell::escape( ...$this->destClusters ); $this->replicaPipes = $this->replicaProcs = []; for ( $i = 0; $i < $this->numProcs; $i++ ) { @@ -271,8 +274,7 @@ class RecompressTracked { * Dispatch a command to the next available replica DB. * This may block until a replica DB finishes its work and becomes available. */ - function dispatch( /*...*/ ) { - $args = func_get_args(); + function dispatch( ...$args ) { $pipes = $this->replicaPipes; $x = []; $y = [];