Go to the documentation of this file.
16 use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
72 use Wikimedia\ObjectFactory;
122 private static $instance =
null;
139 if ( self::$instance ===
null ) {
145 self::$instance = self::newInstance( $bootstrapConfig,
'load' );
148 return self::$instance;
165 if ( !defined(
'MW_PHPUNIT_TEST' ) ) {
166 throw new MWException( __METHOD__ .
' must not be used outside unit tests.' );
169 $old = self::getInstance();
170 self::$instance = $services;
215 if ( self::$instance ===
null ) {
220 self::failIfResetNotAllowed( __METHOD__ );
222 if ( $bootstrapConfig ===
null ) {
223 $bootstrapConfig = self::$instance->getBootstrapConfig();
226 $oldInstance = self::$instance;
228 self::$instance = self::newInstance( $bootstrapConfig,
'load' );
229 self::$instance->importWiring( $oldInstance, [
'BootstrapConfig' ] );
231 if ( $quick ===
'quick' ) {
232 self::$instance->salvage( $oldInstance );
234 $oldInstance->destroy();
248 foreach ( $this->getServiceNames() as $name ) {
253 $oldService = $other->peekService( $name );
254 }
catch ( NoSuchServiceException $e ) {
258 if ( $oldService instanceof SalvageableService ) {
260 $newService = $this->getService( $name );
261 $newService->salvage( $oldService );
284 $instance =
new self( $bootstrapConfig );
287 if ( $loadWiring ===
'load' ) {
288 $wiringFiles = $bootstrapConfig->
get(
'ServiceWiringFiles' );
289 $instance->loadWiringFiles( $wiringFiles );
293 Hooks::run(
'MediaWikiServices', [ $instance ] );
315 $destroy = [
'DBLoadBalancer',
'DBLoadBalancerFactory' ];
316 $services = self::getInstance();
318 foreach ( $destroy as $name ) {
319 $services->disableService( $name );
340 self::resetGlobalInstance();
344 mt_srand( getmypid() );
369 if ( !defined(
'MW_PHPUNIT_TEST' ) && !defined(
'MW_PARSER_TEST' ) ) {
370 throw new MWException(
'resetServiceForTesting() must not be used outside unit tests.' );
373 $this->resetService( $name, $destroy );
404 if ( !defined(
'MW_PHPUNIT_TEST' )
405 && !defined(
'MW_PARSER_TEST' )
406 && !defined(
'MEDIAWIKI_INSTALL' )
407 && !defined(
'RUN_MAINTENANCE_IF_MAIN' )
408 && defined(
'MW_SERVICE_BOOTSTRAP_COMPLETE' )
410 throw new MWException( $method .
' may only be called during bootstrapping and unit tests!' );
420 parent::__construct();
423 $this->defineService(
'BootstrapConfig',
function () use ( $config ) {
435 return $this->getService(
'ActorMigration' );
443 return $this->getService(
'BadFileLookup' );
451 return $this->getService(
'_SqlBlobStore' );
459 return $this->getService(
'BlobStoreFactory' );
467 return $this->getService(
'BlockManager' );
475 return $this->getService(
'BlockRestrictionStore' );
492 return $this->getService(
'BootstrapConfig' );
500 return $this->getService(
'NameTableStoreFactory' )->getChangeTagDef();
508 return $this->getService(
'CommentStore' );
516 return $this->getService(
'ConfigFactory' );
524 return $this->getService(
'ConfigRepository' );
532 return $this->getService(
'ConfiguredReadOnlyMode' );
540 return $this->getService(
'ContentLanguage' );
548 return $this->getService(
'NameTableStoreFactory' )->getContentModels();
556 return $this->getService(
'CryptHKDF' );
564 return $this->getService(
'DateFormatterFactory' );
572 return $this->getService(
'DBLoadBalancer' );
580 return $this->getService(
'DBLoadBalancerFactory' );
588 return $this->getService(
'EventRelayerGroup' );
596 return $this->getService(
'ExternalStoreAccess' );
604 return $this->getService(
'ExternalStoreFactory' );
612 return $this->getService(
'GenderCache' );
620 return $this->getService(
'HttpRequestFactory' );
628 return $this->getService(
'InterwikiLookup' );
636 return $this->getService(
'LanguageNameUtils' );
644 return $this->getService(
'LinkCache' );
655 return $this->getService(
'LinkRenderer' );
663 return $this->getService(
'LinkRendererFactory' );
671 return $this->getService(
'LocalisationCache' );
679 return $this->getService(
'LocalServerObjectCache' );
687 return $this->getService(
'LockManagerGroupFactory' );
695 return $this->getService(
'MagicWordFactory' );
706 return $this->getService(
'MainConfig' );
714 return $this->getService(
'MainObjectStash' );
722 return $this->getService(
'MainWANObjectCache' );
730 return $this->getService(
'MediaHandlerFactory' );
738 return $this->getService(
'MessageCache' );
746 return $this->getService(
'MessageFormatterFactory' );
754 return $this->getService(
'MimeAnalyzer' );
762 return $this->getService(
'MovePageFactory' );
770 return $this->getService(
'NamespaceInfo' );
778 return $this->getService(
'NameTableStoreFactory' );
789 return $this->getService(
'ObjectFactory' );
797 return $this->getService(
'OldRevisionImporter' );
805 return $this->getService(
'PageEditStash' );
813 return $this->getService(
'Parser' );
821 return $this->getService(
'ParserCache' );
829 return $this->getService(
'ParserFactory' );
837 return $this->getService(
'PasswordFactory' );
845 return $this->getService(
'PasswordReset' );
853 return $this->getService(
'PerDbNameStatsdDataFactory' );
861 return $this->getService(
'PermissionManager' );
869 return $this->getService(
'PreferencesFactory' );
877 return $this->getService(
'ProxyLookup' );
885 return $this->getService(
'ReadOnlyMode' );
893 return $this->getService(
'RepoGroup' );
901 return $this->getService(
'ResourceLoader' );
909 return $this->getService(
'RevisionFactory' );
917 return $this->getService(
'RevisionLookup' );
925 return $this->getService(
'RevisionRenderer' );
933 return $this->getService(
'RevisionStore' );
941 return $this->getService(
'RevisionStoreFactory' );
950 return $this->getService(
'SearchEngineFactory' )->create();
958 return $this->getService(
'SearchEngineConfig' );
966 return $this->getService(
'SearchEngineFactory' );
974 return $this->getService(
'ShellCommandFactory' );
982 return $this->getService(
'SiteLookup' );
990 return $this->getService(
'SiteStore' );
998 return $this->getService(
'SkinFactory' );
1006 return $this->getService(
'SlotRoleRegistry' );
1014 return $this->getService(
'NameTableStoreFactory' )->getSlotRoles();
1022 return $this->getService(
'SpecialPageFactory' );
1030 return $this->getService(
'StatsdDataFactory' );
1038 return $this->getService(
'TempFSFileFactory' );
1046 return $this->getService(
'TitleFormatter' );
1054 return $this->getService(
'TitleParser' );
1062 return $this->getService(
'UploadRevisionImporter' );
1070 return $this->getService(
'VirtualRESTServiceClient' );
1078 return $this->getService(
'WatchedItemQueryService' );
1086 return $this->getService(
'WatchedItemStore' );
1094 return $this->getService(
'OldRevisionImporter' );
1102 return $this->getService(
'WikiRevisionOldRevisionImporterNoUpdates' );
1110 return $this->getService(
'UploadRevisionImporter' );
Factory class for spawning EventRelayer objects using configuration.
static clear()
Clear all the cached instances.
Functions to get cache objects.
Cache for article titles (prefixed DB keys) and ids linked from one source.
Wrapper for backward compatibility for old callers that used static methods.
A factory that stores information about MagicWords, and creates them on demand with caching.
Implements functions related to MIME types such as detection and mapping to file extension.
Caches user genders when needed to use correct namespace aliases.
Factory class for SearchEngine.
This class handles the logic for the actor table migration.
Interface for configuration instances.
Class for managing stashed edits used by the page updater classes.
get( $name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".
Virtual HTTP service client loosely styled after a Virtual File System.
Accesses configuration settings from $GLOBALS.
A title parser service for MediaWiki.
Factory for handling the special page list and generating SpecialPage objects.
Factory class to create Skin objects.
Class for caching the contents of localisation files, Messages*.php and *.i18n.php.
Contain a class for special pages.
MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.
Prioritized list of file repositories.
Factory class to create Config objects.
Configuration handling class for SearchEngine.
Factory class for creating and checking Password objects.
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Cache of messages that are defined by MediaWiki namespace pages or by hooks.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Helper class for the password reset functionality shared by the web UI and the API.