Get rid of unnecessary func_get_args() and friends
[lhc/web/wiklou.git] / maintenance / storage / recompressTracked.php
index 271cbf3..f17b00c 100644 (file)
@@ -24,6 +24,8 @@
 
 use MediaWiki\Logger\LegacyLogger;
 use MediaWiki\MediaWikiServices;
+use MediaWiki\Shell\Shell;
+use Wikimedia\Rdbms\IDatabase;
 
 $optionsWithArgs = RecompressTracked::getOptionsWithArgs();
 require __DIR__ . '/../commandLine.inc';
@@ -214,19 +216,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++ ) {
@@ -270,10 +272,11 @@ 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;
-               $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 );
@@ -640,7 +643,7 @@ class RecompressTracked {
        /**
         * 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();