MediaWiki REL1_33
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)
 
 getActorMigration ()
 
 getBlobStore ()
 
 getBlobStoreFactory ()
 
 getBlockRestrictionStore ()
 
 getBootstrapConfig ()
 Returns the Config object containing the bootstrap configuration.
 
 getChangeTagDefStore ()
 
 getCommentStore ()
 
 getConfigFactory ()
 
 getConfigRepository ()
 
 getConfiguredReadOnlyMode ()
 
 getContentLanguage ()
 
 getContentModelStore ()
 
 getCryptHKDF ()
 
 getCryptRand ()
 
 getDBLoadBalancer ()
 
 getDBLoadBalancerFactory ()
 
 getEventRelayerGroup ()
 
 getExternalStoreFactory ()
 
 getGenderCache ()
 
 getHttpRequestFactory ()
 
 getInterwikiLookup ()
 
 getLinkCache ()
 
 getLinkRenderer ()
 LinkRenderer instance that can be used if no custom options are needed.
 
 getLinkRendererFactory ()
 
 getLocalServerObjectCache ()
 
 getMagicWordFactory ()
 
 getMainConfig ()
 Returns the Config object that provides configuration for MediaWiki core.
 
 getMainObjectStash ()
 
 getMainWANObjectCache ()
 
 getMediaHandlerFactory ()
 
 getMimeAnalyzer ()
 
 getNameTableStoreFactory ()
 
 getOldRevisionImporter ()
 
 getParser ()
 
 getParserCache ()
 
 getParserFactory ()
 
 getPasswordFactory ()
 
 getPerDbNameStatsdDataFactory ()
 
 getPermissionManager ()
 
 getPreferencesFactory ()
 
 getProxyLookup ()
 
 getReadOnlyMode ()
 
 getResourceLoader ()
 
 getRevisionFactory ()
 
 getRevisionLookup ()
 
 getRevisionRenderer ()
 
 getRevisionStore ()
 
 getRevisionStoreFactory ()
 
 getSearchEngineConfig ()
 
 getSearchEngineFactory ()
 
 getShellCommandFactory ()
 
 getSiteLookup ()
 
 getSiteStore ()
 
 getSkinFactory ()
 
 getSlotRoleRegistry ()
 
 getSlotRoleStore ()
 
 getSpecialPageFactory ()
 
 getStatsdDataFactory ()
 
 getTitleFormatter ()
 
 getTitleParser ()
 
 getUploadRevisionImporter ()
 
 getVirtualRESTServiceClient ()
 
 getWatchedItemQueryService ()
 
 getWatchedItemStore ()
 
 getWikiRevisionOldRevisionImporter ()
 
 getWikiRevisionOldRevisionImporterNoUpdates ()
 
 getWikiRevisionUploadImporter ()
 
 newSearchEngine ()
 
 resetServiceForTesting ( $name, $destroy=true)
 Resets the given service for testing purposes.
 
- Public Member Functions inherited from Wikimedia\Services\ServiceContainer
 __construct (array $extraInstantiationParams=[])
 
 addServiceManipulator ( $name, callable $manipulator)
 Add a service manipulator callback for the given service.
 
 applyWiring (array $serviceInstantiators)
 Registers multiple services (aka a "wiring").
 
 defineService ( $name, callable $instantiator)
 Define a new service.
 
 destroy ()
 Destroys all contained service instances that implement the DestructibleService interface.
 
 disableService ( $name)
 Disables a service.
 
 getService ( $name)
 Returns a service object of the kind associated with $name.
 
 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.
 
 importWiring (ServiceContainer $container, $skip=[])
 Imports all wiring defined in $container.
 
 isServiceDisabled ( $name)
 
 loadWiringFiles (array $wiringFiles)
 
 peekService ( $name)
 Returns the service instance for $name only if that service has already been instantiated.
 
 redefineService ( $name, callable $instantiator)
 Replace an already defined service.
 

Static Public Member Functions

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 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)
 Salvages the state of any salvageable service instances in $other.
 

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 MediaWikiServices null $instance = null
 

Additional Inherited Members

- Protected Member Functions inherited from Wikimedia\Services\ServiceContainer
 resetService ( $name, $destroy=true)
 Resets a service by dropping the service instance.
 

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 103 of file MediaWikiServices.php.

Constructor & Destructor Documentation

◆ __construct()

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 403 of file MediaWikiServices.php.

References use.

Member Function Documentation

◆ disableStorageBackend()

static MediaWiki\MediaWikiServices::disableStorageBackend ( )
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.

Since
1.28
Warning
This is intended for extreme situations only and should never be used while serving normal web requests. Legitimate use cases for this method include the installation process. Test fixtures may also use this, if the fixture relies on globalState.
See also
resetGlobalInstance()
resetChildProcessServices()

Definition at line 297 of file MediaWikiServices.php.

References $name, $services, and as.

◆ failIfResetNotAllowed()

static MediaWiki\MediaWikiServices::failIfResetNotAllowed (   $method)
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.

Since
1.28

This method will throw an exception if:

  • self::$resetInProgress is false (to allow all services to be reset together via resetGlobalInstance)
  • and MEDIAWIKI_INSTALL is not defined (to allow services to be reset during installation)
  • and MW_PHPUNIT_TEST is not defined (to allow services to be reset during testing)

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.

Parameters
string$methodthe name of the caller method, as given by METHOD.
Exceptions
MWExceptionif called outside bootstrap mode.
See also
resetGlobalInstance()
forceGlobalInstance()
disableStorageBackend()

Definition at line 387 of file MediaWikiServices.php.

◆ forceGlobalInstance()

static MediaWiki\MediaWikiServices::forceGlobalInstance ( MediaWikiServices  $services)
static

Replaces the global MediaWikiServices instance.

Since
1.28
Note
This is for use in PHPUnit tests only!
Exceptions
MWExceptionif called outside of PHPUnit tests.
Parameters
MediaWikiServices$servicesThe new MediaWikiServices object.
Returns
MediaWikiServices The old MediaWikiServices object, so it can be restored later.

Definition at line 150 of file MediaWikiServices.php.

References $services.

◆ getActorMigration()

MediaWiki\MediaWikiServices::getActorMigration ( )
Since
1.31
Returns
ActorMigration

Definition at line 418 of file MediaWikiServices.php.

◆ getBlobStore()

MediaWiki\MediaWikiServices::getBlobStore ( )
Since
1.31
Returns
BlobStore

Definition at line 426 of file MediaWikiServices.php.

◆ getBlobStoreFactory()

MediaWiki\MediaWikiServices::getBlobStoreFactory ( )
Since
1.31
Returns
BlobStoreFactory

Definition at line 434 of file MediaWikiServices.php.

◆ getBlockRestrictionStore()

MediaWiki\MediaWikiServices::getBlockRestrictionStore ( )
Since
1.33
Returns
BlockRestrictionStore

Definition at line 442 of file MediaWikiServices.php.

◆ getBootstrapConfig()

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

Definition at line 459 of file MediaWikiServices.php.

◆ getChangeTagDefStore()

MediaWiki\MediaWikiServices::getChangeTagDefStore ( )
Since
1.32
Returns
NameTableStore

Definition at line 467 of file MediaWikiServices.php.

◆ getCommentStore()

MediaWiki\MediaWikiServices::getCommentStore ( )
Since
1.31
Returns
CommentStore

Definition at line 475 of file MediaWikiServices.php.

◆ getConfigFactory()

MediaWiki\MediaWikiServices::getConfigFactory ( )
Since
1.27
Returns
ConfigFactory

Definition at line 483 of file MediaWikiServices.php.

◆ getConfigRepository()

MediaWiki\MediaWikiServices::getConfigRepository ( )
Since
1.32
Returns
ConfigRepository

Definition at line 491 of file MediaWikiServices.php.

◆ getConfiguredReadOnlyMode()

MediaWiki\MediaWikiServices::getConfiguredReadOnlyMode ( )
Since
1.29
Returns
\ConfiguredReadOnlyMode

Definition at line 499 of file MediaWikiServices.php.

◆ getContentLanguage()

MediaWiki\MediaWikiServices::getContentLanguage ( )
Since
1.32
Returns
\Language

Definition at line 507 of file MediaWikiServices.php.

◆ getContentModelStore()

MediaWiki\MediaWikiServices::getContentModelStore ( )
Since
1.31
Returns
NameTableStore

Definition at line 515 of file MediaWikiServices.php.

◆ getCryptHKDF()

MediaWiki\MediaWikiServices::getCryptHKDF ( )
Since
1.28
Returns
CryptHKDF

Definition at line 523 of file MediaWikiServices.php.

◆ getCryptRand()

MediaWiki\MediaWikiServices::getCryptRand ( )
Since
1.28
Deprecated:
since 1.32, use random_bytes()/random_int()
Returns
CryptRand

Definition at line 532 of file MediaWikiServices.php.

References wfDeprecated().

◆ getDBLoadBalancer()

MediaWiki\MediaWikiServices::getDBLoadBalancer ( )
Since
1.28
Returns
LoadBalancer The main DB load balancer for the local wiki.

Definition at line 541 of file MediaWikiServices.php.

◆ getDBLoadBalancerFactory()

MediaWiki\MediaWikiServices::getDBLoadBalancerFactory ( )
Since
1.28
Returns
LBFactory

Definition at line 549 of file MediaWikiServices.php.

◆ getEventRelayerGroup()

MediaWiki\MediaWikiServices::getEventRelayerGroup ( )
Since
1.27
Returns
EventRelayerGroup

Definition at line 557 of file MediaWikiServices.php.

◆ getExternalStoreFactory()

MediaWiki\MediaWikiServices::getExternalStoreFactory ( )
Since
1.31
Returns
\ExternalStoreFactory

Definition at line 565 of file MediaWikiServices.php.

◆ getGenderCache()

MediaWiki\MediaWikiServices::getGenderCache ( )
Since
1.28
Returns
GenderCache

Definition at line 573 of file MediaWikiServices.php.

◆ getHttpRequestFactory()

MediaWiki\MediaWikiServices::getHttpRequestFactory ( )
Since
1.31
Returns
HttpRequestFactory

Definition at line 581 of file MediaWikiServices.php.

◆ getInstance()

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.

Since
1.27

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 124 of file MediaWikiServices.php.

Referenced by MediaWiki\Session\SessionManager\__construct(), MediaWiki\Auth\Throttler\__construct(), MediaWiki\Session\BotPasswordSessionProviderTest\addDBDataOnce(), MediaWiki\Tests\Revision\McrReadNewRevisionStoreDbTest\assertRevisionExistsInDatabase(), MediaWiki\Tests\Revision\McrRevisionStoreDbTest\assertRevisionExistsInDatabase(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\assertRevisionExistsInDatabase(), MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Preferences\DefaultPreferencesFactory\cleanSignature(), MediaWiki\Shell\Shell\command(), MediaWiki\Tests\Storage\SqlBlobStoreTest\getBlobStore(), MediaWiki\Auth\UserDataAuthenticationRequest\getFieldInfo(), MediaWiki\Tests\Storage\NameTableStoreFactoryTest\getMockLoadBalancerFactory(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\getProvider(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\getProvider(), MediaWiki\Tests\Revision\RevisionStoreTest\getRevisionStore(), MediaWiki\Auth\TemporaryPasswordAuthenticationRequest\newRandom(), MediaWiki\Tests\Maintenance\BackupDumperPageTest\newStreamingDBConnection(), MediaWiki\parseTitle(), MediaWiki\performRequest(), MediaWiki\preOutputCommit(), MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences(), MediaWiki\Widget\Search\BasicSearchResultSetWidget\render(), MediaWiki\Widget\Search\BasicSearchResultSetWidget\renderResultSet(), MediaWiki\restInPeace(), MediaWiki\Linker\LinkRenderer\runLegacyBeginHook(), MediaWiki\setDBProfilingAgent(), MediaWiki\Auth\AuthManager\setDefaultUserOptions(), MediaWiki\Tests\Block\BlockRestrictionStoreTest\setUp(), MediaWiki\Tests\Permissions\PermissionManagerTest\setUp(), MediaWiki\Tests\Storage\PageUpdaterTest\setUp(), MediaWiki\Auth\AuthManager\singleton(), MediaWiki\Widget\Search\SearchFormWidget\startsWithImage(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testCheckPasswordValidity(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testCountRevisionsByPageId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testCountRevisionsByTitle(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testDomainCheck(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testDoParserCacheUpdate(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testDoUpdates(), MediaWiki\Tests\Storage\NameTableStoreFactoryTest\testGet(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testGetCanonicalParserOptions(), MediaWiki\Tests\Maintenance\MaintenanceTest\testGetConfig(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetKnownCurrentRevision(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetKnownCurrentRevision_revDelete(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetKnownCurrentRevision_userNameChange(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testGetNewPasswordExpiry(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetNextRevision(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetNextRevision_bad(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetParentLengths(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testGetPassword(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testGetPasswordFactory(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetPreviousRevision(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetPreviousRevision_bad(), MediaWiki\Tests\Revision\McrReadNewRevisionStoreDbTest\testGetQueryInfo_NoSlotDataJoin(), MediaWiki\Tests\Revision\McrRevisionStoreDbTest\testGetQueryInfo_NoSlotDataJoin(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetRcIdIfUnpatrolled_returnsRecentChangesId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetRcIdIfUnpatrolled_returnsZeroIfPatrolled(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetRecentChange(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetRevisionById(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetRevisionByPageId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetRevisionByTimestamp(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetRevisionByTitle(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testGetSecondaryDataUpdatesWithSlotRemoval(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetTimestampFromId_found(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetTimestampFromId_notFound(), MediaWiki\Tests\Revision\McrWriteBothRevisionStoreDbTest\testInsertRevisionFromArchiveRow_unmigratedArchiveRow(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testInsertRevisionOn_archive(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testInsertRevisionOn_blobAddressExists(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testInsertRevisionOn_failures(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testInsertRevisionOn_successes(), MediaWiki\Tests\Revision\McrRevisionStoreDbTest\testInsertRevisionOn_T202032(), MediaWiki\Tests\Storage\NameTableStoreFactoryTest\testIntegratedGetChangeTagDef(), MediaWiki\Tests\Storage\NameTableStoreFactoryTest\testIntegratedGetContentModels(), MediaWiki\Tests\Storage\NameTableStoreFactoryTest\testIntegratedGetSlotRoles(), MediaWiki\Tests\Permissions\PermissionManagerTest\testJsonConfigEditPermissions(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromPageId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromTimestamp(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromTitle(), MediaWiki\Tests\Revision\RevisionStoreTest\testMigrationConstruction(), MediaWiki\Tests\Storage\BlobStoreFactoryTest\testNewBlobStore(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewMutableRevisionFromArray(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewMutableRevisionFromArray_legacyEncoding(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewNullRevision(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewNullRevision_nonExistingTitle(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromArchiveRow_getArchiveQueryInfo(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromArchiveRow_legacyEncoding(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromArchiveRow_no_user(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromRow_anonEdit(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromRow_anonEdit_legacyEncoding(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromRow_getQueryInfo(), MediaWiki\Tests\Revision\RevisionStoreTest\testNewRevisionFromRow_legacyEncoding_applied(), MediaWiki\Tests\Revision\RevisionStoreTest\testNewRevisionFromRow_legacyEncoding_ignored(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromRow_no_user(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromRow_revDelete(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromRow_userEdit(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromRow_userNameChange(), MediaWiki\Tests\Storage\BlobStoreFactoryTest\testNewSqlBlobStore(), MediaWiki\Tests\Permissions\PermissionManagerTest\testPageRestrictions(), MediaWiki\Tests\Maintenance\BackupDumperLoggerTest\testPlain(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\testPrepareContent(), MediaWiki\Tests\Permissions\PermissionManagerTest\testQuickPermissions(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionStoreGetArchiveQueryInfo(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionStoreGetQueryInfo(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\testRevisionStoreGetSlotsQueryInfo(), MediaWiki\Tests\Revision\RevisionStoreTest\testSetContentHandlerUseDB(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testSetPasswordResetFlag(), MediaWiki\Tests\Storage\PageUpdaterTest\testSetRcPatrolStatus(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testTestUserCanAuthenticate(), MediaWiki\Tests\Storage\NameTableStoreTest\testTransactionDoubleRollback(), MediaWiki\Tests\Storage\NameTableStoreTest\testTransactionRollback(), MediaWiki\Tests\Storage\NameTableStoreTest\testTransactionRollbackWithInterference(), MediaWiki\Tests\Permissions\PermissionManagerTest\testUserBlock(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testUserWasLastToEdit_false(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testUserWasLastToEdit_true(), MediaWiki\Tests\Maintenance\BackupDumperLoggerTest\testXmlDumpsBackupUseCaseLogging(), MediaWiki\triggerAsyncJobs(), MediaWiki\tryNormaliseRedirect(), and MediaWiki\Preferences\DefaultPreferencesFactory\validateSignature().

◆ getInterwikiLookup()

MediaWiki\MediaWikiServices::getInterwikiLookup ( )
Since
1.28
Returns
InterwikiLookup

Definition at line 589 of file MediaWikiServices.php.

◆ getLinkCache()

MediaWiki\MediaWikiServices::getLinkCache ( )
Since
1.28
Returns
LinkCache

Definition at line 597 of file MediaWikiServices.php.

◆ getLinkRenderer()

MediaWiki\MediaWikiServices::getLinkRenderer ( )

LinkRenderer instance that can be used if no custom options are needed.

Since
1.28
Returns
LinkRenderer

Definition at line 608 of file MediaWikiServices.php.

◆ getLinkRendererFactory()

MediaWiki\MediaWikiServices::getLinkRendererFactory ( )
Since
1.28
Returns
LinkRendererFactory

Definition at line 616 of file MediaWikiServices.php.

◆ getLocalServerObjectCache()

MediaWiki\MediaWikiServices::getLocalServerObjectCache ( )
Since
1.28
Returns
\BagOStuff

Definition at line 624 of file MediaWikiServices.php.

◆ getMagicWordFactory()

MediaWiki\MediaWikiServices::getMagicWordFactory ( )
Since
1.32
Returns
MagicWordFactory

Definition at line 632 of file MediaWikiServices.php.

◆ getMainConfig()

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().

Since
1.27
Returns
Config

Definition at line 643 of file MediaWikiServices.php.

◆ getMainObjectStash()

MediaWiki\MediaWikiServices::getMainObjectStash ( )
Since
1.28
Returns
\BagOStuff

Definition at line 651 of file MediaWikiServices.php.

◆ getMainWANObjectCache()

MediaWiki\MediaWikiServices::getMainWANObjectCache ( )
Since
1.28
Returns
\WANObjectCache

Definition at line 659 of file MediaWikiServices.php.

◆ getMediaHandlerFactory()

MediaWiki\MediaWikiServices::getMediaHandlerFactory ( )
Since
1.28
Returns
MediaHandlerFactory

Definition at line 667 of file MediaWikiServices.php.

◆ getMimeAnalyzer()

MediaWiki\MediaWikiServices::getMimeAnalyzer ( )
Since
1.28
Returns
MimeAnalyzer

Definition at line 675 of file MediaWikiServices.php.

◆ getNameTableStoreFactory()

MediaWiki\MediaWikiServices::getNameTableStoreFactory ( )
Since
1.32
Returns
NameTableStoreFactory

Definition at line 683 of file MediaWikiServices.php.

◆ getOldRevisionImporter()

MediaWiki\MediaWikiServices::getOldRevisionImporter ( )
Returns
OldRevisionImporter

Definition at line 690 of file MediaWikiServices.php.

◆ getParser()

MediaWiki\MediaWikiServices::getParser ( )
Since
1.29
Returns
Parser

Definition at line 698 of file MediaWikiServices.php.

◆ getParserCache()

MediaWiki\MediaWikiServices::getParserCache ( )
Since
1.30
Returns
ParserCache

Definition at line 706 of file MediaWikiServices.php.

◆ getParserFactory()

MediaWiki\MediaWikiServices::getParserFactory ( )
Since
1.32
Returns
ParserFactory

Definition at line 714 of file MediaWikiServices.php.

◆ getPasswordFactory()

MediaWiki\MediaWikiServices::getPasswordFactory ( )
Since
1.32
Returns
PasswordFactory

Definition at line 722 of file MediaWikiServices.php.

◆ getPerDbNameStatsdDataFactory()

MediaWiki\MediaWikiServices::getPerDbNameStatsdDataFactory ( )
Since
1.32
Returns
StatsdDataFactoryInterface

Definition at line 730 of file MediaWikiServices.php.

◆ getPermissionManager()

MediaWiki\MediaWikiServices::getPermissionManager ( )
Since
1.33
Returns
PermissionManager

Definition at line 738 of file MediaWikiServices.php.

◆ getPreferencesFactory()

MediaWiki\MediaWikiServices::getPreferencesFactory ( )
Since
1.31
Returns
PreferencesFactory

Definition at line 746 of file MediaWikiServices.php.

◆ getProxyLookup()

MediaWiki\MediaWikiServices::getProxyLookup ( )
Since
1.28
Returns
ProxyLookup

Definition at line 754 of file MediaWikiServices.php.

◆ getReadOnlyMode()

MediaWiki\MediaWikiServices::getReadOnlyMode ( )
Since
1.29
Returns
\ReadOnlyMode

Definition at line 762 of file MediaWikiServices.php.

◆ getResourceLoader()

MediaWiki\MediaWikiServices::getResourceLoader ( )
Since
1.33
Returns
ResourceLoader

Definition at line 770 of file MediaWikiServices.php.

◆ getRevisionFactory()

MediaWiki\MediaWikiServices::getRevisionFactory ( )
Since
1.31
Returns
RevisionFactory

Definition at line 778 of file MediaWikiServices.php.

◆ getRevisionLookup()

MediaWiki\MediaWikiServices::getRevisionLookup ( )
Since
1.31
Returns
RevisionLookup

Definition at line 786 of file MediaWikiServices.php.

◆ getRevisionRenderer()

MediaWiki\MediaWikiServices::getRevisionRenderer ( )
Since
1.32
Returns
RevisionRenderer

Definition at line 794 of file MediaWikiServices.php.

◆ getRevisionStore()

MediaWiki\MediaWikiServices::getRevisionStore ( )
Since
1.31
Returns
RevisionStore

Definition at line 802 of file MediaWikiServices.php.

◆ getRevisionStoreFactory()

MediaWiki\MediaWikiServices::getRevisionStoreFactory ( )
Since
1.32
Returns
RevisionStoreFactory

Definition at line 810 of file MediaWikiServices.php.

◆ getSearchEngineConfig()

MediaWiki\MediaWikiServices::getSearchEngineConfig ( )
Since
1.27
Returns
SearchEngineConfig

Definition at line 827 of file MediaWikiServices.php.

Referenced by buildCommonApiParams().

◆ getSearchEngineFactory()

MediaWiki\MediaWikiServices::getSearchEngineFactory ( )
Since
1.27
Returns
SearchEngineFactory

Definition at line 835 of file MediaWikiServices.php.

◆ getShellCommandFactory()

MediaWiki\MediaWikiServices::getShellCommandFactory ( )
Since
1.30
Returns
CommandFactory

Definition at line 843 of file MediaWikiServices.php.

◆ getSiteLookup()

MediaWiki\MediaWikiServices::getSiteLookup ( )
Since
1.27
Returns
SiteLookup

Definition at line 851 of file MediaWikiServices.php.

◆ getSiteStore()

MediaWiki\MediaWikiServices::getSiteStore ( )
Since
1.27
Returns
SiteStore

Definition at line 859 of file MediaWikiServices.php.

◆ getSkinFactory()

MediaWiki\MediaWikiServices::getSkinFactory ( )
Since
1.27
Returns
SkinFactory

Definition at line 867 of file MediaWikiServices.php.

◆ getSlotRoleRegistry()

MediaWiki\MediaWikiServices::getSlotRoleRegistry ( )
Since
1.33
Returns
SlotRoleRegistry

Definition at line 875 of file MediaWikiServices.php.

◆ getSlotRoleStore()

MediaWiki\MediaWikiServices::getSlotRoleStore ( )
Since
1.31
Returns
NameTableStore

Definition at line 883 of file MediaWikiServices.php.

◆ getSpecialPageFactory()

MediaWiki\MediaWikiServices::getSpecialPageFactory ( )
Since
1.32
Returns
SpecialPageFactory

Definition at line 891 of file MediaWikiServices.php.

◆ getStatsdDataFactory()

MediaWiki\MediaWikiServices::getStatsdDataFactory ( )
Since
1.27
Returns
IBufferingStatsdDataFactory

Definition at line 899 of file MediaWikiServices.php.

◆ getTitleFormatter()

MediaWiki\MediaWikiServices::getTitleFormatter ( )
Since
1.28
Returns
TitleFormatter

Definition at line 907 of file MediaWikiServices.php.

◆ getTitleParser()

MediaWiki\MediaWikiServices::getTitleParser ( )
Since
1.28
Returns
TitleParser

Definition at line 915 of file MediaWikiServices.php.

◆ getUploadRevisionImporter()

MediaWiki\MediaWikiServices::getUploadRevisionImporter ( )
Since
1.32
Returns
UploadRevisionImporter

Definition at line 923 of file MediaWikiServices.php.

◆ getVirtualRESTServiceClient()

MediaWiki\MediaWikiServices::getVirtualRESTServiceClient ( )
Since
1.28
Returns
VirtualRESTServiceClient

Definition at line 931 of file MediaWikiServices.php.

◆ getWatchedItemQueryService()

MediaWiki\MediaWikiServices::getWatchedItemQueryService ( )
Since
1.28
Returns
WatchedItemQueryService

Definition at line 939 of file MediaWikiServices.php.

◆ getWatchedItemStore()

MediaWiki\MediaWikiServices::getWatchedItemStore ( )
Since
1.28
Returns
WatchedItemStoreInterface

Definition at line 947 of file MediaWikiServices.php.

◆ getWikiRevisionOldRevisionImporter()

MediaWiki\MediaWikiServices::getWikiRevisionOldRevisionImporter ( )
Since
1.31
Returns
\OldRevisionImporter

Definition at line 955 of file MediaWikiServices.php.

◆ getWikiRevisionOldRevisionImporterNoUpdates()

MediaWiki\MediaWikiServices::getWikiRevisionOldRevisionImporterNoUpdates ( )
Since
1.31
Returns
\OldRevisionImporter

Definition at line 963 of file MediaWikiServices.php.

◆ getWikiRevisionUploadImporter()

MediaWiki\MediaWikiServices::getWikiRevisionUploadImporter ( )
Since
1.31
Returns
\UploadRevisionImporter

Definition at line 971 of file MediaWikiServices.php.

◆ newInstance()

static MediaWiki\MediaWikiServices::newInstance ( Config  $bootstrapConfig,
  $loadWiring = '' 
)
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.

Parameters
Config | null$bootstrapConfigThe Config object to be registered as the 'BootstrapConfig' service.
string$loadWiringset this to 'load' to load the wiring files specified in the 'ServiceWiringFiles' setting in $bootstrapConfig.
Returns
MediaWikiServices
Exceptions
MWException

\FatalError

Definition at line 267 of file MediaWikiServices.php.

References Config\get().

◆ newSearchEngine()

MediaWiki\MediaWikiServices::newSearchEngine ( )
Since
1.27
Returns
SearchEngine

Definition at line 818 of file MediaWikiServices.php.

◆ resetChildProcessServices()

static MediaWiki\MediaWikiServices::resetChildProcessServices ( )
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.

Since
1.28
Note
This is intended for use in the context of process forking only!
See also
resetGlobalInstance()
disableStorageBackend()

Definition at line 321 of file MediaWikiServices.php.

◆ resetGlobalInstance()

static MediaWiki\MediaWikiServices::resetGlobalInstance ( Config  $bootstrapConfig = null,
  $quick = '' 
)
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().

Since
1.28
Warning
This should not be used during normal operation. It is intended for use when the configuration has changed significantly since bootstrap time, e.g. during the installation process or during testing.
Calling resetGlobalInstance() may leave the application in an inconsistent state. Calling this is only safe under the ASSUMPTION that NO REFERENCE to any of the services managed by MediaWikiServices exist. If any service objects managed by the old MediaWikiServices instance remain in use, they may INTERFERE with the operation of the services managed by the new MediaWikiServices. Operating with a mix of services created by the old and the new MediaWikiServices instance may lead to INCONSISTENCIES and even DATA LOSS! Any class implementing LAZY LOADING is especially prone to this problem, since instances would typically retain a reference to a storage layer service.
See also
forceGlobalInstance()
resetGlobalInstance()
resetBetweenTest()
Parameters
Config | null$bootstrapConfigThe 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$quickSet this to "quick" to allow expensive resources to be re-used. See SalvageableService for details.
Exceptions
MWExceptionIf 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 200 of file MediaWikiServices.php.

◆ resetServiceForTesting()

MediaWiki\MediaWikiServices::resetServiceForTesting (   $name,
  $destroy = true 
)

Resets the given service for testing purposes.

Since
1.28
Warning
This is generally unsafe! Other services may still retain references to the stale service instance, leading to failures and inconsistencies. Subclasses may use this method to reset specific services under specific instances, but it should not be exposed to application logic.
Note
With proper dependency injection used throughout the codebase, this method should not be needed. It is provided to allow tests that pollute global service instances to clean up.
Parameters
string$name
bool$destroyWhether the service instance should be destroyed if it exists. When set to false, any existing service instance will effectively be detached from the container.
Exceptions
MWExceptionif called outside of PHPUnit tests.

Definition at line 352 of file MediaWikiServices.php.

References $name.

◆ salvage()

MediaWiki\MediaWikiServices::salvage ( self  $other)
private

Salvages the state of any salvageable service instances in $other.

Note
$other will have been destroyed when salvage() returns.
Parameters
MediaWikiServices$other

Definition at line 231 of file MediaWikiServices.php.

References $e, $name, and as.

Member Data Documentation

◆ $instance

MediaWikiServices null MediaWiki\MediaWikiServices::$instance = null
staticprivate

Definition at line 108 of file MediaWikiServices.php.


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