use MediaWiki\MediaWikiServices;
return [
- 'DBLoadBalancerFactory' => function( MediaWikiServices $services ) {
- // NOTE: Defining the LBFactory class via LBFactoryConf is supported for
- // backwards compatibility. The preferred way would be to register a
- // callback for DBLoadBalancerFactory that constructs the desired LBFactory
- // directly.
- $config = $services->getMainConfig()->get( 'LBFactoryConf' );
-
- $class = LBFactory::getLBFactoryClass( $config );
- if ( !isset( $config['readOnlyReason'] ) ) {
- // TODO: replace the global wfConfiguredReadOnlyReason() with a service.
- $config['readOnlyReason'] = wfConfiguredReadOnlyReason();
- }
-
- return new $class( $config );
- },
-
- 'DBLoadBalancer' => function( MediaWikiServices $services ) {
- // just return the default LB from the DBLoadBalancerFactory service
- return $services->getDBLoadBalancerFactory()->getMainLB();
- },
-
'SiteStore' => function( MediaWikiServices $services ) {
- $rawSiteStore = new DBSiteStore( $services->getDBLoadBalancer() );
+ $loadBalancer = wfGetLB(); // TODO: use LB from MediaWikiServices
+ $rawSiteStore = new DBSiteStore( $loadBalancer );
// TODO: replace wfGetCache with a CacheFactory service.
// TODO: replace wfIsHHVM with a capabilities service.
return $services->getConfigFactory()->makeConfig( 'main' );
},
- 'WatchedItemStore' => function( MediaWikiServices $services ) {
- $store = new WatchedItemStore(
- $services->getDBLoadBalancer(),
- new HashBagOStuff( [ 'maxKeys' => 100 ] )
+ 'StatsdDataFactory' => function( MediaWikiServices $services ) {
+ return new BufferingStatsdDataFactory(
+ rtrim( $services->getMainConfig()->get( 'StatsdMetricPrefix' ), '.' )
);
- $store->setStatsdDataFactory( RequestContext::getMain()->getStats() );
- return $store;
+ },
+
+ 'EventRelayerGroup' => function( MediaWikiServices $services ) {
+ return new EventRelayerGroup( $services->getMainConfig()->get( 'EventRelayerConfig' ) );
+ },
+
+ 'SearchEngineFactory' => function( MediaWikiServices $services ) {
+ // Create search engine
+ return new SearchEngineFactory( $services->getService( 'SearchEngineConfig' ) );
+ },
+
+ 'SearchEngineConfig' => function( MediaWikiServices $services ) {
+ // Create a search engine config from main config.
+ $config = $services->getService( 'MainConfig' );
+ return new SearchEngineConfig( $config );
}
///////////////////////////////////////////////////////////////////////////