Go to the documentation of this file.
15 use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
108 private static $instance =
null;
125 if ( self::$instance ===
null ) {
131 self::$instance = self::newInstance( $bootstrapConfig,
'load' );
134 return self::$instance;
151 if ( !defined(
'MW_PHPUNIT_TEST' ) ) {
152 throw new MWException( __METHOD__ .
' must not be used outside unit tests.' );
155 $old = self::getInstance();
201 if ( self::$instance ===
null ) {
206 self::failIfResetNotAllowed( __METHOD__ );
208 if ( $bootstrapConfig ===
null ) {
209 $bootstrapConfig = self::$instance->getBootstrapConfig();
212 $oldInstance = self::$instance;
214 self::$instance = self::newInstance( $bootstrapConfig,
'load' );
215 self::$instance->importWiring( $oldInstance, [
'BootstrapConfig' ] );
217 if ( $quick ===
'quick' ) {
218 self::$instance->salvage( $oldInstance );
220 $oldInstance->destroy();
232 foreach ( $this->getServiceNames()
as $name ) {
237 $oldService = $other->peekService(
$name );
238 }
catch ( NoSuchServiceException
$e ) {
242 if ( $oldService instanceof SalvageableService ) {
244 $newService = $this->getService(
$name );
245 $newService->salvage( $oldService );
268 $instance =
new self( $bootstrapConfig );
271 if ( $loadWiring ===
'load' ) {
272 $wiringFiles = $bootstrapConfig->
get(
'ServiceWiringFiles' );
273 $instance->loadWiringFiles( $wiringFiles );
277 Hooks::run(
'MediaWikiServices', [ $instance ] );
299 $destroy = [
'DBLoadBalancer',
'DBLoadBalancerFactory' ];
302 foreach ( $destroy
as $name ) {
324 self::resetGlobalInstance();
328 mt_srand( getmypid() );
353 if ( !defined(
'MW_PHPUNIT_TEST' ) && !defined(
'MW_PARSER_TEST' ) ) {
354 throw new MWException(
'resetServiceForTesting() must not be used outside unit tests.' );
357 $this->resetService(
$name, $destroy );
388 if ( !defined(
'MW_PHPUNIT_TEST' )
389 && !defined(
'MW_PARSER_TEST' )
390 && !defined(
'MEDIAWIKI_INSTALL' )
391 && !defined(
'RUN_MAINTENANCE_IF_MAIN' )
392 && defined(
'MW_SERVICE_BOOTSTRAP_COMPLETE' )
394 throw new MWException( $method .
' may only be called during bootstrapping and unit tests!' );
404 parent::__construct();
407 $this->defineService(
'BootstrapConfig',
function ()
use ( $config ) {
419 return $this->getService(
'ActorMigration' );
427 return $this->getService(
'_SqlBlobStore' );
435 return $this->getService(
'BlobStoreFactory' );
443 return $this->getService(
'BlockRestrictionStore' );
460 return $this->getService(
'BootstrapConfig' );
468 return $this->getService(
'NameTableStoreFactory' )->getChangeTagDef();
476 return $this->getService(
'CommentStore' );
484 return $this->getService(
'ConfigFactory' );
492 return $this->getService(
'ConfigRepository' );
500 return $this->getService(
'ConfiguredReadOnlyMode' );
508 return $this->getService(
'ContentLanguage' );
516 return $this->getService(
'NameTableStoreFactory' )->getContentModels();
524 return $this->getService(
'CryptHKDF' );
534 return $this->getService(
'CryptRand' );
542 return $this->getService(
'DBLoadBalancer' );
550 return $this->getService(
'DBLoadBalancerFactory' );
558 return $this->getService(
'EventRelayerGroup' );
566 return $this->getService(
'ExternalStoreFactory' );
574 return $this->getService(
'GenderCache' );
582 return $this->getService(
'HttpRequestFactory' );
590 return $this->getService(
'InterwikiLookup' );
598 return $this->getService(
'LinkCache' );
609 return $this->getService(
'LinkRenderer' );
617 return $this->getService(
'LinkRendererFactory' );
625 return $this->getService(
'LocalServerObjectCache' );
633 return $this->getService(
'MagicWordFactory' );
644 return $this->getService(
'MainConfig' );
652 return $this->getService(
'MainObjectStash' );
660 return $this->getService(
'MainWANObjectCache' );
668 return $this->getService(
'MediaHandlerFactory' );
676 return $this->getService(
'MimeAnalyzer' );
684 return $this->getService(
'NameTableStoreFactory' );
691 return $this->getService(
'OldRevisionImporter' );
699 return $this->getService(
'Parser' );
707 return $this->getService(
'ParserCache' );
715 return $this->getService(
'ParserFactory' );
723 return $this->getService(
'PasswordFactory' );
731 return $this->getService(
'PerDbNameStatsdDataFactory' );
739 return $this->getService(
'PermissionManager' );
747 return $this->getService(
'PreferencesFactory' );
755 return $this->getService(
'ProxyLookup' );
763 return $this->getService(
'ReadOnlyMode' );
771 return $this->getService(
'ResourceLoader' );
779 return $this->getService(
'RevisionFactory' );
787 return $this->getService(
'RevisionLookup' );
795 return $this->getService(
'RevisionRenderer' );
803 return $this->getService(
'RevisionStore' );
811 return $this->getService(
'RevisionStoreFactory' );
820 return $this->getService(
'SearchEngineFactory' )->create();
828 return $this->getService(
'SearchEngineConfig' );
836 return $this->getService(
'SearchEngineFactory' );
844 return $this->getService(
'ShellCommandFactory' );
852 return $this->getService(
'SiteLookup' );
860 return $this->getService(
'SiteStore' );
868 return $this->getService(
'SkinFactory' );
876 return $this->getService(
'SlotRoleRegistry' );
884 return $this->getService(
'NameTableStoreFactory' )->getSlotRoles();
892 return $this->getService(
'SpecialPageFactory' );
900 return $this->getService(
'StatsdDataFactory' );
908 return $this->getService(
'TitleFormatter' );
916 return $this->getService(
'TitleParser' );
924 return $this->getService(
'UploadRevisionImporter' );
932 return $this->getService(
'VirtualRESTServiceClient' );
940 return $this->getService(
'WatchedItemQueryService' );
948 return $this->getService(
'WatchedItemStore' );
956 return $this->getService(
'OldRevisionImporter' );
964 return $this->getService(
'WikiRevisionOldRevisionImporterNoUpdates' );
972 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.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
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