Merge "docs: Ignore extensions/ and skins/ in mwdocgen.php by default"
[lhc/web/wiklou.git] / includes / export / DumpPipeOutput.php
index 61177ab..0521c5a 100644 (file)
  * @file
  */
 
+use MediaWiki\Shell\Shell;
+
 /**
  * @ingroup Dump
  */
 class DumpPipeOutput extends DumpFileOutput {
        protected $command, $filename;
+       /** @var resource|bool */
        protected $procOpenResource = false;
 
        /**
         * @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 +64,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 +97,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 );
                        }
                }