},
'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 ) {
foreach ( $config['paths'] as $prefix => $serviceConfig ) {
$class = $serviceConfig['class'];
// Merge in the global defaults
- $constructArg = isset( $serviceConfig['options'] )
- ? $serviceConfig['options']
- : [];
+ $constructArg = $serviceConfig['options'] ?? [];
$constructArg += $config['global'];
// Make the VRS service available at the mount point
$vrsClient->mount( $prefix, [ 'class' => $class, 'config' => $constructArg ] );