return new WatchedItemQueryService( $services->getDBLoadBalancer() );
},
+ 'MediaHandlerFactory' => function( MediaWikiServices $services ) {
+ return new MediaHandlerFactory(
+ $services->getMainConfig()->get( 'MediaHandlers' )
+ );
+ },
+
'LinkCache' => function( MediaWikiServices $services ) {
return new LinkCache(
- $services->getTitleFormatter()
+ $services->getTitleFormatter(),
+ ObjectCache::getMainWANInstance()
);
},
return $services->getService( '_MediaWikiTitleCodec' );
},
+ 'VirtualRESTServiceClient' => function( MediaWikiServices $services ) {
+ $config = $services->getMainConfig()->get( 'VirtualRestConfig' );
+
+ $vrsClient = new VirtualRESTServiceClient( new MultiHttpClient( [] ) );
+ foreach ( $config['paths'] as $prefix => $serviceConfig ) {
+ $class = $serviceConfig['class'];
+ // Merge in the global defaults
+ $constructArg = isset( $serviceConfig['options'] )
+ ? $serviceConfig['options']
+ : [];
+ $constructArg += $config['global'];
+ // Make the VRS service available at the mount point
+ $vrsClient->mount( $prefix, [ 'class' => $class, 'config' => $constructArg ] );
+ }
+
+ return $vrsClient;
+ },
+
///////////////////////////////////////////////////////////////////////////
// NOTE: When adding a service here, don't forget to add a getter function
// in the MediaWikiServices class. The convenience getter should just call