Merge "Switch ServiceWiring to the new execution framework"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 4 Apr 2018 14:09:33 +0000 (14:09 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 4 Apr 2018 14:09:33 +0000 (14:09 +0000)
includes/ServiceWiring.php

index 5131917..dd837a8 100644 (file)
@@ -286,8 +286,14 @@ return [
 
                $detectorCmd = $mainConfig->get( 'MimeDetectorCommand' );
                if ( $detectorCmd ) {
-                       $params['detectCallback'] = function ( $file ) use ( $detectorCmd ) {
-                               return wfShellExec( "$detectorCmd " . wfEscapeShellArg( $file ) );
+                       $factory = $services->getShellCommandFactory();
+                       $params['detectCallback'] = function ( $file ) use ( $detectorCmd, $factory ) {
+                               $result = $factory->create()
+                                       // $wgMimeDetectorCommand can contain commands with parameters
+                                       ->unsafeParams( $detectorCmd )
+                                       ->params( $file )
+                                       ->execute();
+                               return $result->getStdout();
                        };
                }