Go to the documentation of this file.
15 use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
104 private static $instance =
null;
121 if ( self::$instance ===
null ) {
127 self::$instance = self::newInstance( $bootstrapConfig,
'load' );
130 return self::$instance;
147 if ( !defined(
'MW_PHPUNIT_TEST' ) ) {
148 throw new MWException( __METHOD__ .
' must not be used outside unit tests.' );
151 $old = self::getInstance();
197 if ( self::$instance ===
null ) {
202 self::failIfResetNotAllowed( __METHOD__ );
204 if ( $bootstrapConfig ===
null ) {
205 $bootstrapConfig = self::$instance->getBootstrapConfig();
208 $oldInstance = self::$instance;
210 self::$instance = self::newInstance( $bootstrapConfig,
'load' );
211 self::$instance->importWiring( $oldInstance, [
'BootstrapConfig' ] );
213 if ( $quick ===
'quick' ) {
214 self::$instance->salvage( $oldInstance );
216 $oldInstance->destroy();
228 foreach ( $this->getServiceNames()
as $name ) {
233 $oldService = $other->peekService(
$name );
234 }
catch ( NoSuchServiceException
$e ) {
238 if ( $oldService instanceof SalvageableService ) {
240 $newService = $this->getService(
$name );
241 $newService->salvage( $oldService );
264 $instance =
new self( $bootstrapConfig );
267 if ( $loadWiring ===
'load' ) {
268 $wiringFiles = $bootstrapConfig->
get(
'ServiceWiringFiles' );
269 $instance->loadWiringFiles( $wiringFiles );
273 Hooks::run(
'MediaWikiServices', [ $instance ] );
295 $destroy = [
'DBLoadBalancer',
'DBLoadBalancerFactory' ];
298 foreach ( $destroy
as $name ) {
320 self::resetGlobalInstance();
324 mt_srand( getmypid() );
349 if ( !defined(
'MW_PHPUNIT_TEST' ) && !defined(
'MW_PARSER_TEST' ) ) {
350 throw new MWException(
'resetServiceForTesting() must not be used outside unit tests.' );
353 $this->resetService(
$name, $destroy );
384 if ( !defined(
'MW_PHPUNIT_TEST' )
385 && !defined(
'MW_PARSER_TEST' )
386 && !defined(
'MEDIAWIKI_INSTALL' )
387 && !defined(
'RUN_MAINTENANCE_IF_MAIN' )
388 && defined(
'MW_SERVICE_BOOTSTRAP_COMPLETE' )
390 throw new MWException( $method .
' may only be called during bootstrapping and unit tests!' );
400 parent::__construct();
403 $this->defineService(
'BootstrapConfig',
function ()
use ( $config ) {
415 return $this->getService(
'ActorMigration' );
423 return $this->getService(
'_SqlBlobStore' );
431 return $this->getService(
'BlobStoreFactory' );
448 return $this->getService(
'BootstrapConfig' );
456 return $this->getService(
'NameTableStoreFactory' )->getChangeTagDef();
464 return $this->getService(
'CommentStore' );
472 return $this->getService(
'ConfigFactory' );
480 return $this->getService(
'ConfigRepository' );
488 return $this->getService(
'ConfiguredReadOnlyMode' );
496 return $this->getService(
'ContentLanguage' );
504 return $this->getService(
'NameTableStoreFactory' )->getContentModels();
512 return $this->getService(
'CryptHKDF' );
521 return $this->getService(
'CryptRand' );
529 return $this->getService(
'DBLoadBalancer' );
537 return $this->getService(
'DBLoadBalancerFactory' );
545 return $this->getService(
'EventRelayerGroup' );
553 return $this->getService(
'ExternalStoreFactory' );
561 return $this->getService(
'GenderCache' );
569 return $this->getService(
'HttpRequestFactory' );
577 return $this->getService(
'InterwikiLookup' );
585 return $this->getService(
'LinkCache' );
596 return $this->getService(
'LinkRenderer' );
604 return $this->getService(
'LinkRendererFactory' );
612 return $this->getService(
'LocalServerObjectCache' );
620 return $this->getService(
'MagicWordFactory' );
631 return $this->getService(
'MainConfig' );
639 return $this->getService(
'MainObjectStash' );
647 return $this->getService(
'MainWANObjectCache' );
655 return $this->getService(
'MediaHandlerFactory' );
663 return $this->getService(
'MimeAnalyzer' );
671 return $this->getService(
'NameTableStoreFactory' );
678 return $this->getService(
'OldRevisionImporter' );
686 return $this->getService(
'Parser' );
694 return $this->getService(
'ParserCache' );
702 return $this->getService(
'ParserFactory' );
710 return $this->getService(
'PasswordFactory' );
718 return $this->getService(
'PerDbNameStatsdDataFactory' );
726 return $this->getService(
'PreferencesFactory' );
734 return $this->getService(
'ProxyLookup' );
742 return $this->getService(
'ReadOnlyMode' );
750 return $this->getService(
'RevisionFactory' );
758 return $this->getService(
'RevisionLookup' );
766 return $this->getService(
'RevisionRenderer' );
774 return $this->getService(
'RevisionStore' );
782 return $this->getService(
'RevisionStoreFactory' );
791 return $this->getService(
'SearchEngineFactory' )->create();
799 return $this->getService(
'SearchEngineConfig' );
807 return $this->getService(
'SearchEngineFactory' );
815 return $this->getService(
'ShellCommandFactory' );
823 return $this->getService(
'SiteLookup' );
831 return $this->getService(
'SiteStore' );
839 return $this->getService(
'SkinFactory' );
847 return $this->getService(
'NameTableStoreFactory' )->getSlotRoles();
855 return $this->getService(
'SpecialPageFactory' );
863 return $this->getService(
'StatsdDataFactory' );
871 return $this->getService(
'TitleFormatter' );
879 return $this->getService(
'TitleParser' );
887 return $this->getService(
'UploadRevisionImporter' );
895 return $this->getService(
'VirtualRESTServiceClient' );
903 return $this->getService(
'WatchedItemQueryService' );
911 return $this->getService(
'WatchedItemStore' );
919 return $this->getService(
'OldRevisionImporter' );
927 return $this->getService(
'WikiRevisionOldRevisionImporterNoUpdates' );
935 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.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Interface for configuration instances.
get( $name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".
Virtual HTTP service client loosely styled after a Virtual File System.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Accesses configuration settings from $GLOBALS.
A title parser service for MediaWiki.
Allows to change the fields on the form that will be generated $name
Factory for handling the special page list and generating SpecialPage objects.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Factory class to create Skin objects.
Contain a class for special pages.
MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Factory class to create Config objects.
Configuration handling class for SearchEngine.
Factory class for creating and checking Password objects.
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response 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
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
In both all secondary updates will be triggered handle like object that caches derived data representing a and can trigger updates of cached copies of that e g in the links the ParserCache