function( MediaWikiServices $services ) { $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. $cache = wfGetCache( wfIsHHVM() ? CACHE_ACCEL : CACHE_ANYTHING ); return new CachingSiteStore( $rawSiteStore, $cache ); }, 'SiteLookup' => function( MediaWikiServices $services ) { // Use the default SiteStore as the SiteLookup implementation for now return $services->getSiteStore(); }, 'ConfigFactory' => function( MediaWikiServices $services ) { // Use the bootstrap config to initialize the ConfigFactory. $registry = $services->getBootstrapConfig()->get( 'ConfigRegistry' ); $factory = new ConfigFactory(); foreach ( $registry as $name => $callback ) { $factory->register( $name, $callback ); } return $factory; }, 'MainConfig' => function( MediaWikiServices $services ) { // Use the 'main' config from the ConfigFactory service. return $services->getConfigFactory()->makeConfig( 'main' ); }, 'StatsdDataFactory' => function( MediaWikiServices $services ) { return new BufferingStatsdDataFactory( rtrim( $services->getMainConfig()->get( 'StatsdMetricPrefix' ), '.' ) ); }, /////////////////////////////////////////////////////////////////////////// // NOTE: When adding a service here, don't forget to add a getter function // in the MediaWikiServices class. The convenience getter should just call // $this->getService( 'FooBarService' ). /////////////////////////////////////////////////////////////////////////// ];