MediaWiki REL1_37
|
MediaWikiServices is the service locator for the application scope of MediaWiki. More...
Static Public Member Functions | |
static | allowGlobalInstance () |
Allows a global service container instance to exist. | |
static | disableStorageBackend () |
Disables all storage layer services. | |
static | failIfResetNotAllowed ( $method) |
Convenience method that throws an exception unless it is called during a phase in which resetting of global services is allowed. | |
static | forceGlobalInstance (MediaWikiServices $services) |
Replaces the global MediaWikiServices instance. | |
static | getInstance () |
Returns the global default instance of the top level service locator. | |
static | hasInstance () |
Returns true if an instance has already been initialized. | |
static | resetChildProcessServices () |
Resets any services that may have become stale after a child process returns from after pcntl_fork(). | |
static | resetGlobalInstance (Config $bootstrapConfig=null, $quick='') |
Creates a new instance of MediaWikiServices and sets it as the global default instance. | |
Private Member Functions | |
salvage (self $other) | |
@noinspection PhpDocSignatureInspection | |
Static Private Member Functions | |
static | newInstance (Config $bootstrapConfig, $loadWiring='') |
Creates a new MediaWikiServices instance and initializes it according to the given $bootstrapConfig. | |
Static Private Attributes | |
static bool | $globalInstanceAllowed = false |
static MediaWikiServices null | $instance = null |
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().
Definition at line 190 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::__construct | ( | Config | $config | ) |
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. |
Definition at line 552 of file MediaWikiServices.php.
|
static |
Allows a global service container instance to exist.
This should be called only after configuration settings have been read and extensions have been registered. Any change made to configuration after this method has been called may be ineffective or even harmful.
Definition at line 214 of file MediaWikiServices.php.
|
static |
Disables all storage layer services.
After calling this, any attempt to access the storage layer will result in an error. Use resetGlobalInstance() to restore normal operation.
Definition at line 446 of file MediaWikiServices.php.
|
static |
Convenience method that throws an exception unless it is called during a phase in which resetting of global services is allowed.
In general, services should not be reset individually, since that may introduce inconsistencies.
This method will throw an exception if:
This method is intended to be used to safeguard against accidentally resetting global service instances that are not yet managed by MediaWikiServices. It is defined here in the MediaWikiServices services class to have a central place for managing service bootstrapping and resetting.
string | $method | the name of the caller method, as given by METHOD. |
MWException | if called outside bootstrap mode. |
Definition at line 536 of file MediaWikiServices.php.
|
static |
Replaces the global MediaWikiServices instance.
MWException | if called outside of PHPUnit tests. |
MediaWikiServices | $services | The new MediaWikiServices object. |
Definition at line 295 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getActionFactory | ( | ) |
MediaWiki\MediaWikiServices::getActorMigration | ( | ) |
MediaWiki\MediaWikiServices::getActorNormalization | ( | ) |
MediaWiki\MediaWikiServices::getActorStore | ( | ) |
MediaWiki\MediaWikiServices::getActorStoreFactory | ( | ) |
MediaWiki\MediaWikiServices::getAuthManager | ( | ) |
MediaWiki\MediaWikiServices::getBacklinkCacheFactory | ( | ) |
MediaWiki\MediaWikiServices::getBadFileLookup | ( | ) |
MediaWiki\MediaWikiServices::getBlobStore | ( | ) |
MediaWiki\MediaWikiServices::getBlobStoreFactory | ( | ) |
MediaWiki\MediaWikiServices::getBlockActionInfo | ( | ) |
MediaWiki\MediaWikiServices::getBlockErrorFormatter | ( | ) |
MediaWiki\MediaWikiServices::getBlockManager | ( | ) |
MediaWiki\MediaWikiServices::getBlockPermissionCheckerFactory | ( | ) |
Definition at line 671 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getBlockRestrictionStore | ( | ) |
MediaWiki\MediaWikiServices::getBlockUserFactory | ( | ) |
MediaWiki\MediaWikiServices::getBlockUtils | ( | ) |
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.
Definition at line 712 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getBotPasswordStore | ( | ) |
MediaWiki\MediaWikiServices::getCentralIdLookup | ( | ) |
MediaWiki\MediaWikiServices::getCentralIdLookupFactory | ( | ) |
MediaWiki\MediaWikiServices::getChangeTagDefStore | ( | ) |
MediaWiki\MediaWikiServices::getCollationFactory | ( | ) |
MediaWiki\MediaWikiServices::getCommentStore | ( | ) |
MediaWiki\MediaWikiServices::getConfigFactory | ( | ) |
MediaWiki\MediaWikiServices::getConfigRepository | ( | ) |
MediaWiki\MediaWikiServices::getConfiguredReadOnlyMode | ( | ) |
MediaWiki\MediaWikiServices::getContentHandlerFactory | ( | ) |
MediaWiki\MediaWikiServices::getContentLanguage | ( | ) |
Definition at line 800 of file MediaWikiServices.php.
Referenced by MediaWiki\Rest\EntryPoint\getTextFormatters().
MediaWiki\MediaWikiServices::getContentModelChangeFactory | ( | ) |
MediaWiki\MediaWikiServices::getContentModelStore | ( | ) |
MediaWiki\MediaWikiServices::getContentTransformer | ( | ) |
MediaWiki\MediaWikiServices::getContributionsLookup | ( | ) |
MediaWiki\MediaWikiServices::getCriticalSectionProvider | ( | ) |
MediaWiki\MediaWikiServices::getCryptHKDF | ( | ) |
MediaWiki\MediaWikiServices::getDatabaseBlockStore | ( | ) |
MediaWiki\MediaWikiServices::getDateFormatterFactory | ( | ) |
MediaWiki\MediaWikiServices::getDBLoadBalancer | ( | ) |
Definition at line 872 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getDBLoadBalancerFactory | ( | ) |
MediaWiki\MediaWikiServices::getDeletePageFactory | ( | ) |
MediaWiki\MediaWikiServices::getEmailer | ( | ) |
MediaWiki\MediaWikiServices::getEventRelayerGroup | ( | ) |
MediaWiki\MediaWikiServices::getExternalStoreAccess | ( | ) |
MediaWiki\MediaWikiServices::getExternalStoreFactory | ( | ) |
MediaWiki\MediaWikiServices::getFileBackendGroup | ( | ) |
MediaWiki\MediaWikiServices::getGenderCache | ( | ) |
MediaWiki\MediaWikiServices::getGlobalIdGenerator | ( | ) |
MediaWiki\MediaWikiServices::getGroupPermissionsLookup | ( | ) |
MediaWiki\MediaWikiServices::getHookContainer | ( | ) |
MediaWiki\MediaWikiServices::getHtmlCacheUpdater | ( | ) |
MediaWiki\MediaWikiServices::getHttpRequestFactory | ( | ) |
|
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.
Definition at line 251 of file MediaWikiServices.php.
References wfDeprecatedMsg().
Referenced by MediaWiki\Session\SessionManager\__construct(), MediaWiki\Session\UserInfo\__construct(), MediaWiki\Auth\Throttler\__construct(), MediaWiki\Block\DatabaseBlock\__construct(), MediaWiki\Preferences\DefaultPreferencesFactory\__construct(), MediaWiki\EditPage\TextConflictHelper\__construct(), MediaWiki\Preferences\SignatureValidator\__construct(), MediaWiki\Rest\Handler\ParsoidHTMLHelper\assertParsoidInstalled(), MediaWiki\EditPage\TextboxBuilder\buildTextboxAttribs(), MediaWiki\Rest\Handler\ParsoidHTMLHelper\createParsoid(), MediaWiki\Block\DatabaseBlock\delete(), MediaWiki\Block\DatabaseBlock\doAutoblock(), MediaWiki\Search\SearchWidgets\FullSearchResultWidget\generateFileHtml(), MediaWiki\Auth\UserDataAuthenticationRequest\getFieldInfo(), MediaWiki\Preferences\MultiUsernameFilter\getLookup(), MediaWiki\Rest\EntryPoint\getMainRequest(), MediaWiki\EditPage\TextboxBuilder\getTextboxProtectionCSSClasses(), MediaWiki\Block\DatabaseBlock\initFromRow(), MediaWiki\Block\DatabaseBlock\insert(), MediaWiki\Block\DatabaseBlock\isExemptedFromAutoblocks(), MediaWiki\Session\SessionManager\logPotentialSessionLeakage(), MediaWiki\Session\UserInfo\newFromId(), MediaWiki\Session\UserInfo\newFromName(), MediaWiki\Block\DatabaseBlock\newLoad(), MediaWiki\Auth\TemporaryPasswordAuthenticationRequest\newRandom(), MediaWiki\parseTitle(), MediaWiki\Search\SearchWidgets\BasicSearchResultSetWidget\render(), MediaWiki\Session\SessionBackend\save(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\sendPasswordResetEmail(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProvider\testUserForCreation(), and MediaWiki\Block\DatabaseBlock\update().
MediaWiki\MediaWikiServices::getInterwikiLookup | ( | ) |
MediaWiki\MediaWikiServices::getJobQueueGroup | ( | ) |
MediaWiki\MediaWikiServices::getJobQueueGroupFactory | ( | ) |
MediaWiki\MediaWikiServices::getJobRunner | ( | ) |
MediaWiki\MediaWikiServices::getJsonCodec | ( | ) |
MediaWiki\MediaWikiServices::getLanguageConverterFactory | ( | ) |
MediaWiki\MediaWikiServices::getLanguageFactory | ( | ) |
MediaWiki\MediaWikiServices::getLanguageFallback | ( | ) |
MediaWiki\MediaWikiServices::getLanguageNameUtils | ( | ) |
MediaWiki\MediaWikiServices::getLinkBatchFactory | ( | ) |
MediaWiki\MediaWikiServices::getLinkCache | ( | ) |
MediaWiki\MediaWikiServices::getLinkRenderer | ( | ) |
LinkRenderer instance that can be used if no custom options are needed.
Definition at line 1075 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getLinkRendererFactory | ( | ) |
MediaWiki\MediaWikiServices::getLocalisationCache | ( | ) |
MediaWiki\MediaWikiServices::getLocalServerObjectCache | ( | ) |
Returns the main server-local cache, yielding EmptyBagOStuff if there is none.
In web request mode, the cache should at least be shared among web workers. In CLI mode, the cache should at least be shared among processes run by the same user.
Definition at line 1104 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getLockManagerGroupFactory | ( | ) |
MediaWiki\MediaWikiServices::getMagicWordFactory | ( | ) |
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().
Definition at line 1131 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getMainObjectStash | ( | ) |
Returns the main object stash, yielding EmptyBagOStuff if there is none.
The stash should be shared among all datacenters
Definition at line 1143 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getMainWANObjectCache | ( | ) |
Returns the main WAN cache, yielding EmptyBagOStuff if there is none.
The cache should relay any purge operations to all datacenterss
Definition at line 1155 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getMediaHandlerFactory | ( | ) |
MediaWiki\MediaWikiServices::getMergeHistoryFactory | ( | ) |
MediaWiki\MediaWikiServices::getMessageCache | ( | ) |
MediaWiki\MediaWikiServices::getMessageFormatterFactory | ( | ) |
Definition at line 1187 of file MediaWikiServices.php.
Referenced by MediaWiki\Rest\EntryPoint\getTextFormatters().
MediaWiki\MediaWikiServices::getMimeAnalyzer | ( | ) |
MediaWiki\MediaWikiServices::getMovePageFactory | ( | ) |
MediaWiki\MediaWikiServices::getNamespaceInfo | ( | ) |
MediaWiki\MediaWikiServices::getNameTableStoreFactory | ( | ) |
MediaWiki\MediaWikiServices::getObjectFactory | ( | ) |
ObjectFactory is intended for instantiating "handlers" from declarative definitions, such as Action API modules, special pages, or REST API handlers.
Definition at line 1230 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getOldRevisionImporter | ( | ) |
MediaWiki\MediaWikiServices::getPageEditStash | ( | ) |
MediaWiki\MediaWikiServices::getPageProps | ( | ) |
MediaWiki\MediaWikiServices::getPageStore | ( | ) |
MediaWiki\MediaWikiServices::getPageStoreFactory | ( | ) |
MediaWiki\MediaWikiServices::getPageUpdaterFactory | ( | ) |
MediaWiki\MediaWikiServices::getParser | ( | ) |
MediaWiki\MediaWikiServices::getParserCache | ( | ) |
MediaWiki\MediaWikiServices::getParserCacheFactory | ( | ) |
MediaWiki\MediaWikiServices::getParserFactory | ( | ) |
MediaWiki\MediaWikiServices::getParserOutputAccess | ( | ) |
MediaWiki\MediaWikiServices::getPasswordFactory | ( | ) |
MediaWiki\MediaWikiServices::getPasswordReset | ( | ) |
MediaWiki\MediaWikiServices::getPerDbNameStatsdDataFactory | ( | ) |
MediaWiki\MediaWikiServices::getPermissionManager | ( | ) |
MediaWiki\MediaWikiServices::getPreferencesFactory | ( | ) |
MediaWiki\MediaWikiServices::getProxyLookup | ( | ) |
MediaWiki\MediaWikiServices::getReadOnlyMode | ( | ) |
MediaWiki\MediaWikiServices::getRepoGroup | ( | ) |
MediaWiki\MediaWikiServices::getResourceLoader | ( | ) |
MediaWiki\MediaWikiServices::getRestrictionStore | ( | ) |
MediaWiki\MediaWikiServices::getRevertedTagUpdateManager | ( | ) |
MediaWiki\MediaWikiServices::getRevisionFactory | ( | ) |
MediaWiki\MediaWikiServices::getRevisionLookup | ( | ) |
MediaWiki\MediaWikiServices::getRevisionRenderer | ( | ) |
MediaWiki\MediaWikiServices::getRevisionStore | ( | ) |
MediaWiki\MediaWikiServices::getRevisionStoreFactory | ( | ) |
MediaWiki\MediaWikiServices::getRollbackPageFactory | ( | ) |
MediaWiki\MediaWikiServices::getSearchEngineConfig | ( | ) |
MediaWiki\MediaWikiServices::getSearchEngineFactory | ( | ) |
MediaWiki\MediaWikiServices::getService | ( | $name | ) |
Definition at line 273 of file MediaWikiServices.php.
References wfDeprecatedMsg().
MediaWiki\MediaWikiServices::getShellboxClientFactory | ( | ) |
MediaWiki\MediaWikiServices::getShellCommandFactory | ( | ) |
MediaWiki\MediaWikiServices::getSiteLookup | ( | ) |
MediaWiki\MediaWikiServices::getSiteStore | ( | ) |
MediaWiki\MediaWikiServices::getSkinFactory | ( | ) |
MediaWiki\MediaWikiServices::getSlotRoleRegistry | ( | ) |
MediaWiki\MediaWikiServices::getSlotRoleStore | ( | ) |
MediaWiki\MediaWikiServices::getSpamChecker | ( | ) |
MediaWiki\MediaWikiServices::getSpecialPageFactory | ( | ) |
MediaWiki\MediaWikiServices::getStatsdDataFactory | ( | ) |
MediaWiki\MediaWikiServices::getTalkPageNotificationManager | ( | ) |
MediaWiki\MediaWikiServices::getTempFSFileFactory | ( | ) |
MediaWiki\MediaWikiServices::getTidy | ( | ) |
MediaWiki\MediaWikiServices::getTitleFactory | ( | ) |
MediaWiki\MediaWikiServices::getTitleFormatter | ( | ) |
MediaWiki\MediaWikiServices::getTitleParser | ( | ) |
MediaWiki\MediaWikiServices::getUnblockUserFactory | ( | ) |
MediaWiki\MediaWikiServices::getUploadRevisionImporter | ( | ) |
MediaWiki\MediaWikiServices::getUserCache | ( | ) |
MediaWiki\MediaWikiServices::getUserEditTracker | ( | ) |
MediaWiki\MediaWikiServices::getUserFactory | ( | ) |
MediaWiki\MediaWikiServices::getUserGroupManager | ( | ) |
MediaWiki\MediaWikiServices::getUserGroupManagerFactory | ( | ) |
MediaWiki\MediaWikiServices::getUserIdentityLookup | ( | ) |
MediaWiki\MediaWikiServices::getUserNamePrefixSearch | ( | ) |
MediaWiki\MediaWikiServices::getUserNameUtils | ( | ) |
MediaWiki\MediaWikiServices::getUserOptionsLookup | ( | ) |
MediaWiki\MediaWikiServices::getUserOptionsManager | ( | ) |
MediaWiki\MediaWikiServices::getVirtualRESTServiceClient | ( | ) |
MediaWiki\MediaWikiServices::getWatchedItemQueryService | ( | ) |
MediaWiki\MediaWikiServices::getWatchedItemStore | ( | ) |
MediaWiki\MediaWikiServices::getWatchlistManager | ( | ) |
MediaWiki\MediaWikiServices::getWatchlistNotificationManager | ( | ) |
Definition at line 1736 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getWikiImporterFactory | ( | ) |
MediaWiki\MediaWikiServices::getWikiPageFactory | ( | ) |
MediaWiki\MediaWikiServices::getWikiRevisionOldRevisionImporter | ( | ) |
MediaWiki\MediaWikiServices::getWikiRevisionOldRevisionImporterNoUpdates | ( | ) |
MediaWiki\MediaWikiServices::getWikiRevisionUploadImporter | ( | ) |
|
static |
Returns true if an instance has already been initialized.
This can be used to avoid accessing services if it's not safe, such as in unit tests or early setup.
Definition at line 231 of file MediaWikiServices.php.
|
staticprivate |
Creates a new MediaWikiServices instance and initializes it according to the given $bootstrapConfig.
In particular, all wiring files defined in the ServiceWiringFiles setting are loaded, and the MediaWikiServices hook is called.
Config | $bootstrapConfig | The Config object to be registered as the 'BootstrapConfig' service. |
string | $loadWiring | set this to 'load' to load the wiring files specified in the 'ServiceWiringFiles' setting in $bootstrapConfig. |
MWException | |
\FatalError
Definition at line 419 of file MediaWikiServices.php.
References Config\get().
MediaWiki\MediaWikiServices::newSearchEngine | ( | ) |
|
static |
Resets any services that may have become stale after a child process returns from after pcntl_fork().
It's also safe, but generally unnecessary, to call this method from the parent process.
Definition at line 470 of file MediaWikiServices.php.
|
static |
Creates a new instance of MediaWikiServices and sets it as the global default instance.
getInstance() will return a different MediaWikiServices object after every call to resetGlobalInstance().
Config | null | $bootstrapConfig | 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. If not given, the bootstrap config of the old instance of MediaWikiServices will be re-used. If there was no previous instance, a new GlobalVarConfig object will be used to bootstrap the services. |
string | $quick | Set this to "quick" to allow expensive resources to be re-used. See SalvageableService for details. |
MWException | If called after MW_SERVICE_BOOTSTRAP_COMPLETE has been defined in Setup.php (unless MW_PHPUNIT_TEST or MEDIAWIKI_INSTALL or RUN_MAINTENANCE_IF_MAIN is defined). |
Definition at line 345 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::resetServiceForTesting | ( | $name, | |
$destroy = true |
|||
) |
Resets the given service for testing purposes.
string | $name | |
bool | $destroy | Whether the service instance should be destroyed if it exists. When set to false, any existing service instance will effectively be detached from the container. |
MWException | if called outside of PHPUnit tests. |
Definition at line 501 of file MediaWikiServices.php.
|
private |
@noinspection PhpDocSignatureInspection
Salvages the state of any salvageable service instances in $other.
MediaWikiServices | $other |
Definition at line 383 of file MediaWikiServices.php.
|
staticprivate |
Definition at line 196 of file MediaWikiServices.php.
|
staticprivate |
Definition at line 201 of file MediaWikiServices.php.