$class = MWLBFactory::getLBFactoryClass( $lbConf );
$instance = new $class( $lbConf );
- MWLBFactory::setSchemaAliases( $instance );
+ MWLBFactory::setSchemaAliases( $instance, $mainConfig );
return $instance;
},
},
'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 ) {