use MediaWiki\Logger\LegacyLogger;
use MediaWiki\MediaWikiServices;
+use MediaWiki\Shell\Shell;
use Wikimedia\Rdbms\IDatabase;
$optionsWithArgs = RecompressTracked::getOptionsWithArgs();
public $replicaId = false;
public $noCount = false;
public $debugLog, $infoLog, $criticalLog;
+ /** @var ExternalStoreDB */
public $store;
private static $optionsWithArgs = [
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 ) {
* 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++ ) {
* 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 = [];