MediaWiki REL1_32
|
MediaWikiServices is the service locator for the application scope of MediaWiki. More...
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 MediaWiki\Services\ServiceContainer | |
resetService ( $name, $destroy=true) | |
Resets a service by dropping the service instance. | |
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 99 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 399 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 293 of file MediaWikiServices.php.
References $services.
|
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 383 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 146 of file MediaWikiServices.php.
References $services.
MediaWiki\MediaWikiServices::getActorMigration | ( | ) |
MediaWiki\MediaWikiServices::getBlobStore | ( | ) |
MediaWiki\MediaWikiServices::getBlobStoreFactory | ( | ) |
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 447 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getChangeTagDefStore | ( | ) |
MediaWiki\MediaWikiServices::getCommentStore | ( | ) |
MediaWiki\MediaWikiServices::getConfigFactory | ( | ) |
MediaWiki\MediaWikiServices::getConfigRepository | ( | ) |
MediaWiki\MediaWikiServices::getConfiguredReadOnlyMode | ( | ) |
MediaWiki\MediaWikiServices::getContentLanguage | ( | ) |
MediaWiki\MediaWikiServices::getContentModelStore | ( | ) |
MediaWiki\MediaWikiServices::getCryptHKDF | ( | ) |
MediaWiki\MediaWikiServices::getCryptRand | ( | ) |
Definition at line 520 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getDBLoadBalancer | ( | ) |
Definition at line 528 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getDBLoadBalancerFactory | ( | ) |
MediaWiki\MediaWikiServices::getEventRelayerGroup | ( | ) |
MediaWiki\MediaWikiServices::getExternalStoreFactory | ( | ) |
MediaWiki\MediaWikiServices::getGenderCache | ( | ) |
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 120 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\Auth\LegacyHookPreAuthenticationProviderTest\getProvider(), MediaWiki\Tests\Revision\RevisionStoreTest\getRevisionStore(), MediaWiki\Auth\TemporaryPasswordAuthenticationRequest\newRandom(), MediaWiki\parseTitle(), MediaWiki\performRequest(), MediaWiki\Widget\Search\SearchFormWidget\powerSearchBox(), 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\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\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testGetNewPasswordExpiry(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetNextRevision(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetParentLengths(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testGetPassword(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testGetPasswordFactory(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetPreviousRevision(), 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\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\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_userEdit(), MediaWiki\Tests\Storage\BlobStoreFactoryTest\testNewSqlBlobStore(), MediaWiki\Tests\Maintenance\BackupDumperLoggerTest\testPlain(), 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\Revision\RevisionStoreDbTestBase\testUserWasLastToEdit_false(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testUserWasLastToEdit_true(), MediaWiki\Tests\Maintenance\BackupDumperLoggerTest\testXmlDumpsBackupUseCaseLogging(), MediaWiki\triggerAsyncJobs(), MediaWiki\tryNormaliseRedirect(), and MediaWiki\Preferences\DefaultPreferencesFactory\validateSignature().
MediaWiki\MediaWikiServices::getInterwikiLookup | ( | ) |
MediaWiki\MediaWikiServices::getLinkCache | ( | ) |
MediaWiki\MediaWikiServices::getLinkRenderer | ( | ) |
LinkRenderer instance that can be used if no custom options are needed.
Definition at line 595 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getLinkRendererFactory | ( | ) |
MediaWiki\MediaWikiServices::getLocalServerObjectCache | ( | ) |
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 630 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getMainObjectStash | ( | ) |
MediaWiki\MediaWikiServices::getMainWANObjectCache | ( | ) |
MediaWiki\MediaWikiServices::getMediaHandlerFactory | ( | ) |
MediaWiki\MediaWikiServices::getMimeAnalyzer | ( | ) |
MediaWiki\MediaWikiServices::getNameTableStoreFactory | ( | ) |
MediaWiki\MediaWikiServices::getOldRevisionImporter | ( | ) |
Definition at line 677 of file MediaWikiServices.php.
MediaWiki\MediaWikiServices::getParser | ( | ) |
MediaWiki\MediaWikiServices::getParserCache | ( | ) |
MediaWiki\MediaWikiServices::getParserFactory | ( | ) |
MediaWiki\MediaWikiServices::getPasswordFactory | ( | ) |
MediaWiki\MediaWikiServices::getPerDbNameStatsdDataFactory | ( | ) |
MediaWiki\MediaWikiServices::getPreferencesFactory | ( | ) |
MediaWiki\MediaWikiServices::getProxyLookup | ( | ) |
MediaWiki\MediaWikiServices::getReadOnlyMode | ( | ) |
MediaWiki\MediaWikiServices::getRevisionFactory | ( | ) |
MediaWiki\MediaWikiServices::getRevisionLookup | ( | ) |
MediaWiki\MediaWikiServices::getRevisionRenderer | ( | ) |
MediaWiki\MediaWikiServices::getRevisionStore | ( | ) |
MediaWiki\MediaWikiServices::getRevisionStoreFactory | ( | ) |
MediaWiki\MediaWikiServices::getSearchEngineConfig | ( | ) |
MediaWiki\MediaWikiServices::getSearchEngineFactory | ( | ) |
MediaWiki\MediaWikiServices::getShellCommandFactory | ( | ) |
MediaWiki\MediaWikiServices::getSiteLookup | ( | ) |
MediaWiki\MediaWikiServices::getSiteStore | ( | ) |
MediaWiki\MediaWikiServices::getSkinFactory | ( | ) |
MediaWiki\MediaWikiServices::getSlotRoleStore | ( | ) |
MediaWiki\MediaWikiServices::getSpecialPageFactory | ( | ) |
MediaWiki\MediaWikiServices::getStatsdDataFactory | ( | ) |
MediaWiki\MediaWikiServices::getTitleFormatter | ( | ) |
MediaWiki\MediaWikiServices::getTitleParser | ( | ) |
MediaWiki\MediaWikiServices::getUploadRevisionImporter | ( | ) |
MediaWiki\MediaWikiServices::getVirtualRESTServiceClient | ( | ) |
MediaWiki\MediaWikiServices::getWatchedItemQueryService | ( | ) |
MediaWiki\MediaWikiServices::getWatchedItemStore | ( | ) |
MediaWiki\MediaWikiServices::getWikiRevisionOldRevisionImporter | ( | ) |
MediaWiki\MediaWikiServices::getWikiRevisionOldRevisionImporterNoUpdates | ( | ) |
MediaWiki\MediaWikiServices::getWikiRevisionUploadImporter | ( | ) |
|
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 | null | $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 263 of file MediaWikiServices.php.
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 317 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 196 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 348 of file MediaWikiServices.php.
|
private |
Salvages the state of any salvageable service instances in $other.
MediaWikiServices | $other |
Definition at line 227 of file MediaWikiServices.php.
References $e.
|
staticprivate |
Definition at line 104 of file MediaWikiServices.php.