$class = MWLBFactory::getLBFactoryClass( $lbConf );
$instance = new $class( $lbConf );
- MWLBFactory::setSchemaAliases( $instance );
+ MWLBFactory::setSchemaAliases( $instance, $mainConfig );
return $instance;
},
$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();
};
}
},
'LocalServerObjectCache' => function ( MediaWikiServices $services ) {
- $mainConfig = $services->getMainConfig();
-
- if ( function_exists( 'apc_fetch' ) ) {
- $id = 'apc';
- } elseif ( function_exists( 'apcu_fetch' ) ) {
- $id = 'apcu';
- } elseif ( function_exists( 'wincache_ucache_get' ) ) {
- $id = 'wincache';
- } else {
- $id = CACHE_NONE;
- }
-
- if ( !isset( $mainConfig->get( 'ObjectCaches' )[$id] ) ) {
- throw new UnexpectedValueException(
- "Cache type \"$id\" is not present in \$wgObjectCaches." );
- }
-
- return \ObjectCache::newFromParams( $mainConfig->get( 'ObjectCaches' )[$id] );
+ $cacheId = \ObjectCache::detectLocalServerCache();
+ return \ObjectCache::newFromId( $cacheId );
},
'VirtualRESTServiceClient' => function ( MediaWikiServices $services ) {
$authManager = AuthManager::singleton();
$linkRenderer = $services->getLinkRendererFactory()->create();
$config = $services->getMainConfig();
- return new DefaultPreferencesFactory( $config, $wgContLang, $authManager, $linkRenderer );
+ $factory = new DefaultPreferencesFactory( $config, $wgContLang, $authManager, $linkRenderer );
+ $factory->setLogger( LoggerFactory::getInstance( 'preferences' ) );
+
+ return $factory;
},
'HttpRequestFactory' => function ( MediaWikiServices $services ) {