Renames preparatory to parser tests refactor
[lhc/web/wiklou.git] / includes / ServiceWiring.php
index 438f667..8734bd6 100644 (file)
@@ -159,12 +159,15 @@ return [
        },
 
        'MediaHandlerFactory' => function( MediaWikiServices $services ) {
-               return new MediaHandlerFactory();
+               return new MediaHandlerFactory(
+                       $services->getMainConfig()->get( 'MediaHandlers' )
+               );
        },
 
        'LinkCache' => function( MediaWikiServices $services ) {
                return new LinkCache(
-                       $services->getTitleFormatter()
+                       $services->getTitleFormatter(),
+                       ObjectCache::getMainWANInstance()
                );
        },
 
@@ -207,6 +210,24 @@ return [
                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