93 private static $instance =
null;
110 if ( self::$instance ===
null ) {
116 self::$instance = self::newInstance( $bootstrapConfig,
'load' );
119 return self::$instance;
136 if ( !defined(
'MW_PHPUNIT_TEST' ) ) {
137 throw new MWException( __METHOD__ .
' must not be used outside unit tests.' );
140 $old = self::getInstance();
186 if ( self::$instance ===
null ) {
191 self::failIfResetNotAllowed( __METHOD__ );
193 if ( $bootstrapConfig ===
null ) {
194 $bootstrapConfig = self::$instance->getBootstrapConfig();
197 $oldInstance = self::$instance;
199 self::$instance = self::newInstance( $bootstrapConfig,
'load' );
200 self::$instance->importWiring( $oldInstance, [
'BootstrapConfig' ] );
202 if ( $quick ===
'quick' ) {
203 self::$instance->salvage( $oldInstance );
205 $oldInstance->destroy();
217 foreach ( $this->getServiceNames() as $name ) {
222 $oldService = $other->peekService( $name );
229 $newService = $this->getService( $name );
230 $newService->salvage( $oldService );
253 $instance =
new self( $bootstrapConfig );
256 if ( $loadWiring ===
'load' ) {
257 $wiringFiles = $bootstrapConfig->get(
'ServiceWiringFiles' );
258 $instance->loadWiringFiles( $wiringFiles );
262 Hooks::run(
'MediaWikiServices', [ $instance ] );
284 $destroy = [
'DBLoadBalancer',
'DBLoadBalancerFactory' ];
287 foreach ( $destroy as $name ) {
291 ObjectCache::clear();
309 self::resetGlobalInstance();
313 mt_srand( getmypid() );
338 if ( !defined(
'MW_PHPUNIT_TEST' ) && !defined(
'MW_PARSER_TEST' ) ) {
339 throw new MWException(
'resetServiceForTesting() must not be used outside unit tests.' );
342 $this->resetService( $name, $destroy );
373 if ( !defined(
'MW_PHPUNIT_TEST' )
374 && !defined(
'MW_PARSER_TEST' )
375 && !defined(
'MEDIAWIKI_INSTALL' )
376 && !defined(
'RUN_MAINTENANCE_IF_MAIN' )
377 && defined(
'MW_SERVICE_BOOTSTRAP_COMPLETE' )
379 throw new MWException( $method .
' may only be called during bootstrapping and unit tests!' );
389 parent::__construct();
392 $this->defineService(
'BootstrapConfig',
function () use ( $config ) {
413 return $this->getService(
'BootstrapConfig' );
421 return $this->getService(
'ConfigFactory' );
432 return $this->getService(
'MainConfig' );
440 return $this->getService(
'SiteLookup' );
448 return $this->getService(
'SiteStore' );
456 return $this->getService(
'InterwikiLookup' );
464 return $this->getService(
'StatsdDataFactory' );
472 return $this->getService(
'EventRelayerGroup' );
481 return $this->getService(
'SearchEngineFactory' )->create();
489 return $this->getService(
'SearchEngineFactory' );
497 return $this->getService(
'SearchEngineConfig' );
505 return $this->getService(
'SkinFactory' );
513 return $this->getService(
'DBLoadBalancerFactory' );
521 return $this->getService(
'DBLoadBalancer' );
529 return $this->getService(
'WatchedItemStore' );
537 return $this->getService(
'WatchedItemQueryService' );
545 return $this->getService(
'CryptRand' );
553 return $this->getService(
'CryptHKDF' );
561 return $this->getService(
'MediaHandlerFactory' );
569 return $this->getService(
'MimeAnalyzer' );
577 return $this->getService(
'ProxyLookup' );
585 return $this->getService(
'Parser' );
593 return $this->getService(
'ParserCache' );
601 return $this->getService(
'GenderCache' );
609 return $this->getService(
'LinkCache' );
617 return $this->getService(
'LinkRendererFactory' );
628 return $this->getService(
'LinkRenderer' );
636 return $this->getService(
'TitleFormatter' );
644 return $this->getService(
'TitleParser' );
652 return $this->getService(
'MainObjectStash' );
660 return $this->getService(
'MainWANObjectCache' );
668 return $this->getService(
'LocalServerObjectCache' );
676 return $this->getService(
'VirtualRESTServiceClient' );
684 return $this->getService(
'ConfiguredReadOnlyMode' );
692 return $this->getService(
'ReadOnlyMode' );
700 return $this->getService(
'UploadRevisionImporter' );
708 return $this->getService(
'OldRevisionImporter' );
716 return $this->getService(
'WikiRevisionOldRevisionImporterNoUpdates' );
724 return $this->getService(
'ShellCommandFactory' );
732 return $this->getService(
'ExternalStoreFactory' );
740 return $this->getService(
'BlobStoreFactory' );
748 return $this->getService(
'_SqlBlobStore' );
756 return $this->getService(
'RevisionStore' );
764 return $this->getService(
'RevisionLookup' );
772 return $this->getService(
'RevisionFactory' );
780 return $this->getService(
'ContentModelStore' );
788 return $this->getService(
'SlotRoleStore' );
796 return $this->getService(
'PreferencesFactory' );
804 return $this->getService(
'HttpRequestFactory' );
812 return $this->getService(
'CommentStore' );
820 return $this->getService(
'ActorMigration' );
This class handles the logic for the actor table migration.
Factory class to create Config objects.
Factory class for spawning EventRelayer objects using configuration.
Caches user genders when needed to use correct namespace aliases.
Accesses configuration settings from $GLOBALS.
Cache for article titles (prefixed DB keys) and ids linked from one source.
Functions to get cache objects.
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
Configuration handling class for SearchEngine.
Factory class for SearchEngine.
Contain a class for special pages.
Factory class to create Skin objects.
Virtual HTTP service client loosely styled after a Virtual File System.
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title after the basic globals have been set but before ordinary actions take place or wrap services the preferred way to define a new service is the $wgServiceWiringFiles array $services
returning false will NOT prevent logging $e
Interface for configuration instances.
MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.
A title parser service for MediaWiki.