use MediaWiki\Logger\LegacyLogger;
use MediaWiki\MediaWikiServices;
+use MediaWiki\Shell\Shell;
+use Wikimedia\Rdbms\IDatabase;
$optionsWithArgs = RecompressTracked::getOptionsWithArgs();
require __DIR__ . '/../commandLine.inc';
* 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;
- $numPipes = stream_select( $x = [], $pipes, $y = [], 3600 );
+ $x = [];
+ $y = [];
+ $numPipes = stream_select( $x, $pipes, $y, 3600 );
if ( !$numPipes ) {
$this->critical( "Error waiting to write to replica DBs. Aborting" );
exit( 1 );
/**
* Gets a DB master connection for the given external cluster name
* @param string $cluster
- * @return Database
+ * @return IDatabase
*/
function getExtDB( $cluster ) {
$lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();