MediaWiki  1.27.2
MediaWiki\MediaWikiServices Class Reference

MediaWikiServices is the service locator for the application scope of MediaWiki. More...

Inheritance diagram for MediaWiki\MediaWikiServices:
Collaboration diagram for MediaWiki\MediaWikiServices:

Public Member Functions

 __construct (Config $config)
 
 getBootstrapConfig ()
 Returns the Config object containing the bootstrap configuration. More...
 
 getConfigFactory ()
 
 getEventRelayerGroup ()
 
 getMainConfig ()
 Returns the Config object that provides configuration for MediaWiki core. More...
 
 getSearchEngineConfig ()
 
 getSearchEngineFactory ()
 
 getSiteLookup ()
 
 getSiteStore ()
 
 getSkinFactory ()
 
 getStatsdDataFactory ()
 
 newSearchEngine ()
 
- Public Member Functions inherited from MediaWiki\Services\ServiceContainer
 __construct (array $extraInstantiationParams=[])
 
 applyWiring (array $serviceInstantiators)
 Registers multiple services (aka a "wiring"). More...
 
 defineService ($name, callable $instantiator)
 Define a new service. More...
 
 getService ($name)
 Returns a service object of the kind associated with $name. More...
 
 getServiceNames ()
 
 hasService ($name)
 Returns true if a service is defined for $name, that is, if a call to getService( $name ) would return a service instance. More...
 
 loadWiringFiles (array $wiringFiles)
 
 redefineService ($name, callable $instantiator)
 Replace an already defined service. More...
 

Static Public Member Functions

static getInstance ()
 Returns the global default instance of the top level service locator. More...
 

Detailed Description

MediaWikiServices is the service locator for the application scope of MediaWiki.

Its implemented as a simple configurable DI container. MediaWikiServices acts as a top level factory/registry for top level services, and builds the network of service objects that defines MediaWiki's application logic. It acts as an entry point to MediaWiki's dependency injection mechanism.

Services are defined in the "wiring" array passed to the constructor, or by calling defineService().

See also
docs/injection.txt for an overview of using dependency injection in the MediaWiki code base.

Definition at line 54 of file MediaWikiServices.php.

Constructor & Destructor Documentation

MediaWiki\MediaWikiServices::__construct ( Config  $config)
Parameters
Config$configThe Config object to be registered as the 'BootstrapConfig' service. This has to contain at least the information needed to set up the 'ConfigFactory' service.

Definition at line 95 of file MediaWikiServices.php.

References use.

Member Function Documentation

MediaWiki\MediaWikiServices::getBootstrapConfig ( )

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.
Returns
Config

Definition at line 116 of file MediaWikiServices.php.

MediaWiki\MediaWikiServices::getConfigFactory ( )
Returns
ConfigFactory

Definition at line 123 of file MediaWikiServices.php.

MediaWiki\MediaWikiServices::getEventRelayerGroup ( )
Returns
EventRelayerGroup

Definition at line 161 of file MediaWikiServices.php.

the only code that instantiates Foo are implementations of and the only code that instantiates FooFactory is the instantiator in ServiceWiring php *As an intermediate Bar s constructor could initialize the $fooFactory member variable by calling MediaWikiServices::getInstance ( )
static

Returns the global default instance of the top level service locator.

The default instance is initialized using the service instantiator functions defined in ServiceWiring.php.

Note
This should only be called by static functions! The instance returned here should not be passed around! Objects that need access to a service should have that service injected into the constructor, never a service locator!
Returns
MediaWikiServices

Definition at line 68 of file MediaWikiServices.php.

References Hooks\run().

MediaWiki\MediaWikiServices::getMainConfig ( )

Returns the Config object that provides configuration for MediaWiki core.

This may or may not be the same object that is returned by getBootstrapConfig().

Returns
Config

Definition at line 133 of file MediaWikiServices.php.

MediaWiki\MediaWikiServices::getSearchEngineConfig ( )
Returns
SearchEngineConfig

Definition at line 183 of file MediaWikiServices.php.

MediaWiki\MediaWikiServices::getSearchEngineFactory ( )
Returns
SearchEngineFactory

Definition at line 176 of file MediaWikiServices.php.

MediaWiki\MediaWikiServices::getSiteLookup ( )
Returns
SiteLookup

Definition at line 140 of file MediaWikiServices.php.

MediaWiki\MediaWikiServices::getSiteStore ( )
Returns
SiteStore

Definition at line 147 of file MediaWikiServices.php.

MediaWiki\MediaWikiServices::getSkinFactory ( )
Returns
SkinFactory

Definition at line 190 of file MediaWikiServices.php.

MediaWiki\MediaWikiServices::getStatsdDataFactory ( )
Returns
StatsdDataFactory

Definition at line 154 of file MediaWikiServices.php.

MediaWiki\MediaWikiServices::newSearchEngine ( )
Returns
SearchEngine

Definition at line 168 of file MediaWikiServices.php.


The documentation for this class was generated from the following files: