Merge "resourceloader: Simplify isCompatible() parameter in startup.js"
[lhc/web/wiklou.git] / includes / export / DumpPipeOutput.php
index 61177ab..a353c44 100644 (file)
@@ -25,6 +25,8 @@
  * @file
  */
 
+use MediaWiki\Shell\Shell;
+
 /**
  * @ingroup Dump
  */
@@ -34,11 +36,11 @@ class DumpPipeOutput extends DumpFileOutput {
 
        /**
         * @param string $command
-        * @param string $file
+        * @param string|null $file
         */
        function __construct( $command, $file = null ) {
                if ( !is_null( $file ) ) {
-                       $command .= " > " . wfEscapeShellArg( $file );
+                       $command .= " > " . Shell::escape( $file );
                }
 
                $this->startCommand( $command );
@@ -61,10 +63,10 @@ class DumpPipeOutput extends DumpFileOutput {
         * @param string $command
         */
        function startCommand( $command ) {
-               $spec = array(
-                       0 => array( "pipe", "r" ),
-               );
-               $pipes = array();
+               $spec = [
+                       0 => [ "pipe", "r" ],
+               ];
+               $pipes = [];
                $this->procOpenResource = proc_open( $command, $spec, $pipes );
                $this->handle = $pipes[0];
        }
@@ -94,7 +96,7 @@ class DumpPipeOutput extends DumpFileOutput {
                        $this->renameOrException( $newname );
                        if ( $open ) {
                                $command = $this->command;
-                               $command .= " > " . wfEscapeShellArg( $this->filename );
+                               $command .= " > " . Shell::escape( $this->filename );
                                $this->startCommand( $command );
                        }
                }