get( 'ServiceWiringFiles' ); $instance->loadWiringFiles( $wiringFiles ); // Provide a traditional hook point to allow extensions to configure services. Hooks::run( 'MediaWikiServices', [ $instance ] ); } return $instance; } /** * @param Config $config The Config object to be registered as the 'BootstrapConfig' service. * This has to contain at least the information needed to set up the 'ConfigFactory' * service. */ public function __construct( Config $config ) { parent::__construct(); // register the given Config object as the bootstrap config service. $this->defineService( 'BootstrapConfig', function() use ( $config ) { return $config; } ); } /** * Returns the Config object containing the bootstrap configuration. * Bootstrap configuration would typically include database credentials * and other information that may be needed before the ConfigFactory * service can be instantiated. * * @note This should only be used during bootstrapping, in particular * when creating the MainConfig service. Application logic should * use getMainConfig() to get a Config instances. * * @return Config */ public function getBootstrapConfig() { return $this->getService( 'BootstrapConfig' ); } /** * @return ConfigFactory */ public function getConfigFactory() { return $this->getService( 'ConfigFactory' ); } /** * Returns the Config object that provides configuration for MediaWiki core. * This may or may not be the same object that is returned by getBootstrapConfig(). * * @return Config */ public function getMainConfig() { return $this->getService( 'MainConfig' ); } /** * @return SiteLookup */ public function getSiteLookup() { return $this->getService( 'SiteLookup' ); } /** * @return SiteStore */ public function getSiteStore() { return $this->getService( 'SiteStore' ); } /** * @return StatsdDataFactory */ public function getStatsdDataFactory() { return $this->getService( 'StatsdDataFactory' ); } /** * @return EventRelayerGroup */ public function getEventRelayerGroup() { return $this->getService( 'EventRelayerGroup' ); } /** * @return SearchEngine */ public function newSearchEngine() { // New engine object every time, since they keep state return $this->getService( 'SearchEngineFactory' )->create(); } /** * @return SearchEngineFactory */ public function getSearchEngineFactory() { return $this->getService( 'SearchEngineFactory' ); } /** * @return SearchEngineConfig */ public function getSearchEngineConfig() { return $this->getService( 'SearchEngineConfig' ); } /** * @return SkinFactory */ public function getSkinFactory() { return $this->getService( 'SkinFactory' ); } /////////////////////////////////////////////////////////////////////////// // NOTE: When adding a service getter here, don't forget to add a test // case for it in MediaWikiServicesTest::provideGetters() and in // MediaWikiServicesTest::provideGetService()! /////////////////////////////////////////////////////////////////////////// }