Merge "Add DeleteUnknownPreferences hook"
[lhc/web/wiklou.git] / includes / ServiceWiring.php
index 08d343b..dd837a8 100644 (file)
@@ -61,7 +61,10 @@ return [
                );
                $class = MWLBFactory::getLBFactoryClass( $lbConf );
 
-               return new $class( $lbConf );
+               $instance = new $class( $lbConf );
+               MWLBFactory::setSchemaAliases( $instance );
+
+               return $instance;
        },
 
        'DBLoadBalancer' => function ( MediaWikiServices $services ) {
@@ -283,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();
                        };
                }