3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
23 use ExternalStoreAccess
;
24 use ExternalStoreFactory
;
27 use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface
;
28 use LocalisationCache
;
29 use LogFormatterFactory
;
31 use MediaHandlerFactory
;
32 use MediaWiki\Actions\ActionFactory
;
33 use MediaWiki\Auth\AuthManager
;
34 use MediaWiki\Block\AutoblockExemptionList
;
35 use MediaWiki\Block\BlockActionInfo
;
36 use MediaWiki\Block\BlockErrorFormatter
;
37 use MediaWiki\Block\BlockManager
;
38 use MediaWiki\Block\BlockPermissionCheckerFactory
;
39 use MediaWiki\Block\BlockRestrictionStore
;
40 use MediaWiki\Block\BlockRestrictionStoreFactory
;
41 use MediaWiki\Block\BlockUserFactory
;
42 use MediaWiki\Block\BlockUtils
;
43 use MediaWiki\Block\BlockUtilsFactory
;
44 use MediaWiki\Block\DatabaseBlockStore
;
45 use MediaWiki\Block\DatabaseBlockStoreFactory
;
46 use MediaWiki\Block\HideUserUtils
;
47 use MediaWiki\Block\UnblockUserFactory
;
48 use MediaWiki\Cache\BacklinkCacheFactory
;
49 use MediaWiki\Cache\GenderCache
;
50 use MediaWiki\Cache\HTMLCacheUpdater
;
51 use MediaWiki\Cache\LinkBatchFactory
;
52 use MediaWiki\Cache\LinkCache
;
53 use MediaWiki\Cache\UserCache
;
54 use MediaWiki\Category\TrackingCategories
;
55 use MediaWiki\ChangeTags\ChangeTagsStore
;
56 use MediaWiki\Collation\CollationFactory
;
57 use MediaWiki\CommentFormatter\CommentFormatter
;
58 use MediaWiki\CommentFormatter\CommentParserFactory
;
59 use MediaWiki\CommentFormatter\RowCommentFormatter
;
60 use MediaWiki\CommentStore\CommentStore
;
61 use MediaWiki\Config\Config
;
62 use MediaWiki\Config\ConfigFactory
;
63 use MediaWiki\Config\ConfigRepository
;
64 use MediaWiki\Config\GlobalVarConfig
;
65 use MediaWiki\Content\IContentHandlerFactory
;
66 use MediaWiki\Content\Renderer\ContentRenderer
;
67 use MediaWiki\Content\Transform\ContentTransformer
;
68 use MediaWiki\DomainEvent\DomainEventDispatcher
;
69 use MediaWiki\DomainEvent\DomainEventSource
;
70 use MediaWiki\Edit\ParsoidOutputStash
;
71 use MediaWiki\EditPage\IntroMessageBuilder
;
72 use MediaWiki\EditPage\PreloadedContentBuilder
;
73 use MediaWiki\EditPage\SpamChecker
;
74 use MediaWiki\Export\WikiExporterFactory
;
75 use MediaWiki\FileBackend\FileBackendGroup
;
76 use MediaWiki\FileBackend\FSFile\TempFSFileFactory
;
77 use MediaWiki\FileBackend\LockManager\LockManagerGroupFactory
;
78 use MediaWiki\HookContainer\HookContainer
;
79 use MediaWiki\HookContainer\HookRunner
;
80 use MediaWiki\Http\HttpRequestFactory
;
81 use MediaWiki\Installer\Pingback
;
82 use MediaWiki\Interwiki\InterwikiLookup
;
83 use MediaWiki\Interwiki\NullInterwikiLookup
;
84 use MediaWiki\JobQueue\JobFactory
;
85 use MediaWiki\JobQueue\JobQueueGroupFactory
;
86 use MediaWiki\Json\JsonCodec
;
87 use MediaWiki\Language\FormatterFactory
;
88 use MediaWiki\Language\Language
;
89 use MediaWiki\Language\LanguageCode
;
90 use MediaWiki\Languages\LanguageConverterFactory
;
91 use MediaWiki\Languages\LanguageFactory
;
92 use MediaWiki\Languages\LanguageFallback
;
93 use MediaWiki\Languages\LanguageNameUtils
;
94 use MediaWiki\Linker\LinkRenderer
;
95 use MediaWiki\Linker\LinkRendererFactory
;
96 use MediaWiki\Linker\LinksMigration
;
97 use MediaWiki\Linker\LinkTargetLookup
;
98 use MediaWiki\Mail\EmailUserFactory
;
99 use MediaWiki\Mail\IEmailer
;
100 use MediaWiki\OutputTransform\OutputTransformPipeline
;
101 use MediaWiki\Page\ContentModelChangeFactory
;
102 use MediaWiki\Page\DeletePageFactory
;
103 use MediaWiki\Page\File\BadFileLookup
;
104 use MediaWiki\Page\MergeHistoryFactory
;
105 use MediaWiki\Page\MovePageFactory
;
106 use MediaWiki\Page\PageProps
;
107 use MediaWiki\Page\PageStore
;
108 use MediaWiki\Page\PageStoreFactory
;
109 use MediaWiki\Page\ParserOutputAccess
;
110 use MediaWiki\Page\RedirectLookup
;
111 use MediaWiki\Page\RedirectStore
;
112 use MediaWiki\Page\RollbackPageFactory
;
113 use MediaWiki\Page\UndeletePageFactory
;
114 use MediaWiki\Page\WikiPageFactory
;
115 use MediaWiki\Parser\DateFormatterFactory
;
116 use MediaWiki\Parser\MagicWordFactory
;
117 use MediaWiki\Parser\Parser
;
118 use MediaWiki\Parser\ParserCache
;
119 use MediaWiki\Parser\ParserCacheFactory
;
120 use MediaWiki\Parser\ParserFactory
;
121 use MediaWiki\Parser\Parsoid\Config\DataAccess
;
122 use MediaWiki\Parser\Parsoid\Config\PageConfigFactory
;
123 use MediaWiki\Parser\Parsoid\Config\SiteConfig
;
124 use MediaWiki\Parser\Parsoid\HtmlTransformFactory
;
125 use MediaWiki\Parser\Parsoid\LintErrorChecker
;
126 use MediaWiki\Parser\Parsoid\ParsoidParserFactory
;
127 use MediaWiki\Password\PasswordFactory
;
128 use MediaWiki\Permissions\GrantsInfo
;
129 use MediaWiki\Permissions\GrantsLocalization
;
130 use MediaWiki\Permissions\GroupPermissionsLookup
;
131 use MediaWiki\Permissions\PermissionManager
;
132 use MediaWiki\Permissions\RateLimiter
;
133 use MediaWiki\Permissions\RestrictionStore
;
134 use MediaWiki\PoolCounter\PoolCounterFactory
;
135 use MediaWiki\Preferences\PreferencesFactory
;
136 use MediaWiki\Preferences\SignatureValidatorFactory
;
137 use MediaWiki\Registration\ExtensionRegistry
;
138 use MediaWiki\Request\ProxyLookup
;
139 use MediaWiki\ResourceLoader\ResourceLoader
;
140 use MediaWiki\Rest\Handler\Helper\PageRestHelperFactory
;
141 use MediaWiki\Revision\ArchivedRevisionLookup
;
142 use MediaWiki\Revision\RevisionFactory
;
143 use MediaWiki\Revision\RevisionLookup
;
144 use MediaWiki\Revision\RevisionRenderer
;
145 use MediaWiki\Revision\RevisionStore
;
146 use MediaWiki\Revision\RevisionStoreFactory
;
147 use MediaWiki\Revision\SlotRoleRegistry
;
148 use MediaWiki\Search\SearchResultThumbnailProvider
;
149 use MediaWiki\Search\TitleMatcher
;
150 use MediaWiki\Session\SessionManager
;
151 use MediaWiki\Settings\Config\ConfigSchema
;
152 use MediaWiki\Shell\CommandFactory
;
153 use MediaWiki\Shell\ShellboxClientFactory
;
154 use MediaWiki\Site\SiteLookup
;
155 use MediaWiki\Site\SiteStore
;
156 use MediaWiki\SpecialPage\SpecialPageFactory
;
157 use MediaWiki\Storage\BlobStore
;
158 use MediaWiki\Storage\BlobStoreFactory
;
159 use MediaWiki\Storage\NameTableStore
;
160 use MediaWiki\Storage\NameTableStoreFactory
;
161 use MediaWiki\Storage\PageEditStash
;
162 use MediaWiki\Storage\PageUpdaterFactory
;
163 use MediaWiki\Storage\RevertedTagUpdateManager
;
164 use MediaWiki\Tidy\TidyDriverBase
;
165 use MediaWiki\Title\NamespaceInfo
;
166 use MediaWiki\Title\TitleFactory
;
167 use MediaWiki\Title\TitleFormatter
;
168 use MediaWiki\Title\TitleParser
;
169 use MediaWiki\User\ActorMigration
;
170 use MediaWiki\User\ActorNormalization
;
171 use MediaWiki\User\ActorStore
;
172 use MediaWiki\User\ActorStoreFactory
;
173 use MediaWiki\User\BotPasswordStore
;
174 use MediaWiki\User\CentralId\CentralIdLookup
;
175 use MediaWiki\User\CentralId\CentralIdLookupFactory
;
176 use MediaWiki\User\Options\StaticUserOptionsLookup
;
177 use MediaWiki\User\Options\UserOptionsLookup
;
178 use MediaWiki\User\Options\UserOptionsManager
;
179 use MediaWiki\User\PasswordReset
;
180 use MediaWiki\User\Registration\UserRegistrationLookup
;
181 use MediaWiki\User\TalkPageNotificationManager
;
182 use MediaWiki\User\TempUser\RealTempUserConfig
;
183 use MediaWiki\User\TempUser\TempUserCreator
;
184 use MediaWiki\User\UserEditTracker
;
185 use MediaWiki\User\UserFactory
;
186 use MediaWiki\User\UserGroupManager
;
187 use MediaWiki\User\UserGroupManagerFactory
;
188 use MediaWiki\User\UserIdentityLookup
;
189 use MediaWiki\User\UserIdentityUtils
;
190 use MediaWiki\User\UserNamePrefixSearch
;
191 use MediaWiki\User\UserNameUtils
;
192 use MediaWiki\Utils\UrlUtils
;
193 use MediaWiki\Watchlist\WatchedItemQueryService
;
194 use MediaWiki\Watchlist\WatchedItemStoreInterface
;
195 use MediaWiki\Watchlist\WatchlistManager
;
198 use ObjectCacheFactory
;
199 use OldRevisionImporter
;
202 use SearchEngineConfig
;
203 use SearchEngineFactory
;
205 use UploadRevisionImporter
;
206 use WikiImporterFactory
;
207 use Wikimedia\EventRelayer\EventRelayerGroup
;
208 use Wikimedia\Message\IMessageFormatterFactory
;
209 use Wikimedia\Mime\MimeAnalyzer
;
210 use Wikimedia\NonSerializable\NonSerializableTrait
;
211 use Wikimedia\ObjectCache\BagOStuff
;
212 use Wikimedia\ObjectCache\WANObjectCache
;
213 use Wikimedia\ObjectFactory\ObjectFactory
;
214 use Wikimedia\Rdbms\ChronologyProtector
;
215 use Wikimedia\Rdbms\ConfiguredReadOnlyMode
;
216 use Wikimedia\Rdbms\DatabaseFactory
;
217 use Wikimedia\Rdbms\IConnectionProvider
;
218 use Wikimedia\Rdbms\ILoadBalancer
;
219 use Wikimedia\Rdbms\LBFactory
;
220 use Wikimedia\Rdbms\LBFactorySingle
;
221 use Wikimedia\Rdbms\LoadBalancerDisabled
;
222 use Wikimedia\Rdbms\ReadOnlyMode
;
223 use Wikimedia\RequestTimeout\CriticalSectionProvider
;
224 use Wikimedia\Services\NoSuchServiceException
;
225 use Wikimedia\Services\SalvageableService
;
226 use Wikimedia\Services\ServiceContainer
;
227 use Wikimedia\Stats\IBufferingStatsdDataFactory
;
228 use Wikimedia\Stats\StatsFactory
;
229 use Wikimedia\Telemetry\TracerInterface
;
230 use Wikimedia\UUID\GlobalIdGenerator
;
231 use Wikimedia\WRStats\WRStatsFactory
;
234 * Service locator for MediaWiki core services.
236 * Refer to includes/ServiceWiring.php for the default implementations.
238 * @see [Dependency Injection](@ref dependencyinjection) in docs/Injection.md
239 * for the principles of DI and how to use it MediaWiki core.
243 class MediaWikiServices
extends ServiceContainer
{
244 use NonSerializableTrait
;
249 private static $globalInstanceAllowed = false;
254 private static $instance = null;
257 * @see disableStorage()
260 private bool $storageDisabled = false;
263 * Allows a global service container instance to exist.
265 * This should be called only after configuration settings have been read and extensions
266 * have been registered. Any change made to configuration after this method has been called
267 * may be ineffective or even harmful.
273 public static function allowGlobalInstance() {
274 self
::$globalInstanceAllowed = true;
276 if ( self
::$instance ) {
277 // TODO: in 1.37, getInstance() should fail if $globalInstanceAllowed is false! (T153256)
278 // Until then, we have to reset service instances that have already been created.
279 // No need to warn here, getService() has already triggered a deprecation warning.
280 self
::resetGlobalInstance( null, 'quick' );
285 * @internal Should only be used in MediaWikiUnitTestCase
287 public static function disallowGlobalInstanceInUnitTests(): void
{
288 if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
289 throw new LogicException( 'Can only be called in tests' );
291 self
::$globalInstanceAllowed = false;
295 * @internal Should only be used in MediaWikiUnitTestCase
297 public static function allowGlobalInstanceAfterUnitTests(): void
{
298 if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
299 throw new LogicException( 'Can only be called in tests' );
301 self
::$globalInstanceAllowed = true;
305 * Returns true if an instance has already been initialized and can be
306 * obtained from getInstance(). This can be used to avoid accessing
307 * services if it's not safe or un necessary, e.g. in certain cases
308 * in unit tests or during early setup.
310 public static function hasInstance(): bool {
311 // NOTE: an instance could have been set by a call to forceGlobalInstance,
312 // but would still be unusable if $globalInstanceAllowed is false.
313 // This shouldn't happen, but it can during testing.
314 return self
::$instance !== null && self
::$globalInstanceAllowed;
318 * Returns the global default instance of the top level service locator.
320 * @note if called before allowGlobalInstance(), this method will fail.
324 * The default instance is initialized using the service instantiator functions
325 * defined in ServiceWiring.php.
327 * @note This should only be called by static functions! The instance returned here
328 * should not be passed around! Objects that need access to a service should have
329 * that service injected into the constructor, never a service locator!
331 public static function getInstance(): self
{
332 if ( !self
::$globalInstanceAllowed ) {
333 if ( defined( 'MW_PHPUNIT_TEST' ) ) {
334 // Fail hard in PHPUnit tests only
335 throw new LogicException( 'Premature access to service container' );
337 // TODO: getInstance() should always fail if $globalInstanceAllowed is false! (T153256)
338 wfDeprecatedMsg( 'Premature access to service container', '1.36' );
341 if ( self
::$instance === null ) {
342 // NOTE: constructing GlobalVarConfig here is not particularly pretty,
343 // but some information from the global scope has to be injected here,
344 // even if it's just a file name or database credentials to load
345 // configuration from.
346 $bootstrapConfig = new GlobalVarConfig();
347 self
::$instance = self
::newInstance( $bootstrapConfig, 'load' );
349 // Provides a traditional hook point to allow extensions to configure services.
350 // NOTE: Ideally this would be in newInstance() but it causes an infinite run loop
351 $runner = new HookRunner( self
::$instance->getHookContainer() );
352 $runner->onMediaWikiServices( self
::$instance );
354 return self
::$instance;
357 public function getService( $name ) {
358 // TODO: in 1.37, getInstance() should fail if $globalInstanceAllowed is false! (T153256)
359 if ( !self
::$globalInstanceAllowed && $this === self
::$instance ) {
360 wfDeprecatedMsg( "Premature access to service '$name'", '1.36', false, 3 );
363 return parent
::getService( $name );
367 * Replaces the global MediaWikiServices instance.
371 * @note This is for use in PHPUnit tests only!
373 * @param self $services The new MediaWikiServices object.
375 * @return self The old MediaWikiServices object, so it can be restored later.
377 public static function forceGlobalInstance( self
$services ): self
{
378 if ( !defined( 'MW_PHPUNIT_TEST' ) && !defined( 'MW_PARSER_TEST' ) ) {
379 throw new LogicException( __METHOD__
. ' must not be used outside unit tests.' );
382 $old = self
::getInstance();
383 self
::$instance = $services;
389 * Creates a new instance of MediaWikiServices and sets it as the global default
390 * instance. getInstance() will return a different MediaWikiServices object
391 * after every call to resetGlobalInstance().
395 * @warning This should not be used during normal operation. It is intended for use
396 * when the configuration has changed significantly since bootstrap time, e.g.
397 * during the installation process or during testing. The method must not be called after
398 * MW_SERVICE_BOOTSTRAP_COMPLETE has been defined in Setup.php, unless MW_PHPUNIT_TEST or
399 * MEDIAWIKI_INSTALL or RUN_MAINTENANCE_IF_MAIN is defined).
401 * @warning Calling resetGlobalInstance() may leave the application in an inconsistent
402 * state. Calling this is only safe under the ASSUMPTION that NO REFERENCE to
403 * any of the services managed by MediaWikiServices exist. If any service objects
404 * managed by the old MediaWikiServices instance remain in use, they may INTERFERE
405 * with the operation of the services managed by the new MediaWikiServices.
406 * Operating with a mix of services created by the old and the new
407 * MediaWikiServices instance may lead to INCONSISTENCIES and even DATA LOSS!
408 * Any class implementing LAZY LOADING is especially prone to this problem,
409 * since instances would typically retain a reference to a storage layer service.
411 * @see forceGlobalInstance()
412 * @see resetGlobalInstance()
413 * @see resetBetweenTest()
415 * @param Config|null $bootstrapConfig The Config object to be registered as the
416 * 'BootstrapConfig' service. This has to contain at least the information
417 * needed to set up the 'ConfigFactory' service. If not given, the bootstrap
418 * config of the old instance of MediaWikiServices will be re-used. If there
419 * was no previous instance, a new GlobalVarConfig object will be used to
420 * bootstrap the services.
421 * @param string $mode May be one of:
422 * - quick: allow expensive resources to be re-used. See SalvageableService for details.
423 * - reset: discard expensive resources but reuse service wiring (default)
424 * - reload: discard expensive resources and reload the service wiring
426 public static function resetGlobalInstance( ?Config
$bootstrapConfig = null, $mode = 'reset' ) {
427 if ( self
::$instance === null ) {
428 // no global instance yet, nothing to reset
432 self
::failIfResetNotAllowed( __METHOD__
);
434 $oldInstance = self
::$instance;
435 self
::$instance = self
::newInstance(
436 $bootstrapConfig ?? self
::$instance->getBootstrapConfig(),
440 // Provides a traditional hook point to allow extensions to configure services.
441 $runner = new HookRunner( $oldInstance->getHookContainer() );
442 $runner->onMediaWikiServices( self
::$instance );
444 if ( $mode !== 'reload' ) {
445 self
::$instance->importWiring( $oldInstance, [ 'BootstrapConfig' ] );
448 if ( $mode === 'quick' ) {
449 self
::$instance->salvage( $oldInstance );
451 $oldInstance->destroy();
455 /** @noinspection PhpDocSignatureInspection */
458 * Salvages the state of any salvageable service instances in $other.
460 * @note $other will have been destroyed when salvage() returns.
462 private function salvage( self
$other ) {
463 foreach ( $this->getServiceNames() as $name ) {
464 // The service could be new in the new instance and not registered in the
465 // other instance (e.g. an extension that was loaded after the instantiation of
466 // the other instance. Skip this service in this case. See T143974
468 $oldService = $other->peekService( $name );
469 } catch ( NoSuchServiceException
$e ) {
473 if ( $oldService instanceof SalvageableService
) {
474 /** @var SalvageableService $newService */
475 $newService = $this->getService( $name );
476 $newService->salvage( $oldService );
484 * Creates a new MediaWikiServices instance and initializes it according to the
485 * given $bootstrapConfig. In particular, all wiring files defined in the
486 * ServiceWiringFiles setting are loaded, and the MediaWikiServices hook is called.
488 * @param Config $bootstrapConfig The Config object to be registered as the
489 * 'BootstrapConfig' service.
490 * @param string $loadWiring set this to 'load' to load the wiring files specified
491 * in the 'ServiceWiringFiles' setting in $bootstrapConfig.
493 private static function newInstance( Config
$bootstrapConfig, $loadWiring = '' ): self
{
494 $instance = new self( $bootstrapConfig );
496 // Load the default wiring from the specified files.
497 if ( $loadWiring === 'load' ) {
498 $wiringFiles = $bootstrapConfig->get( MainConfigNames
::ServiceWiringFiles
);
499 $instance->loadWiringFiles( $wiringFiles );
506 * Disables all storage layer services. After calling this, any attempt to access the
507 * storage layer will result in an error.
510 * @deprecated since 1.40, use disableStorage() instead.
512 * @warning This is intended for extreme situations, see the documentation of disableStorage() for details.
514 * @see resetGlobalInstance()
515 * @see resetChildProcessServices()
517 public static function disableStorageBackend() {
518 $services = self
::getInstance();
519 $services->disableStorage();
523 * Disables all storage layer services. After calling this, any attempt to access the
524 * storage layer will result in an error. Use resetGlobalInstance() with $mode=reload
525 * to restore normal operation.
529 * @warning This is intended for extreme situations only and should never be used
530 * while serving normal web requests. Legitimate use cases for this method include
531 * the installation process. Test fixtures may also use this, if the fixture relies
534 * @see resetGlobalInstance()
535 * @see resetChildProcessServices()
537 public function disableStorage() {
538 if ( $this->storageDisabled
) {
542 $this->redefineService(
544 static function ( self
$services ) {
545 return new LoadBalancerDisabled();
549 $this->redefineService(
550 'DBLoadBalancerFactory',
551 static function ( self
$services ) {
552 return LBFactorySingle
::newDisabled();
556 $this->redefineService(
558 static function ( self
$services ) {
559 return new NullInterwikiLookup();
563 $this->redefineService(
565 static function ( self
$services ) {
566 return new StaticUserOptionsLookup(
568 $services->getMainConfig()->get( MainConfigNames
::DefaultUserOptions
)
573 $this->addServiceManipulator(
575 static function ( LocalisationCache
$cache ) {
576 $cache->disableBackend();
580 $this->addServiceManipulator(
582 static function ( MessageCache
$cache ) {
587 self
::getInstance()->getObjectCacheFactory()->clear();
589 $this->storageDisabled
= true;
593 * Returns true if disableStorage() has been called on this MediaWikiServices instance.
595 public function isStorageDisabled(): bool {
596 return $this->storageDisabled
;
600 * Resets any services that may have become stale after a child processö
601 * returns from after pcntl_fork(). It's also safe, but generally unnecessary,
602 * to call this method from the parent process.
606 * @note This is intended for use in the context of process forking only!
608 * @see resetGlobalInstance()
609 * @see disableStorage()
611 public static function resetChildProcessServices() {
612 // NOTE: for now, just reset everything. Since we don't know the interdependencies
613 // between services, we can't do this more selectively at this time.
614 self
::resetGlobalInstance();
616 // Child, reseed because there is no bug in PHP:
617 // https://bugs.php.net/bug.php?id=42465
618 mt_srand( getmypid() );
622 * Resets the given service for testing purposes.
626 * @warning This is generally unsafe! Other services may still retain references
627 * to the stale service instance, leading to failures and inconsistencies. Subclasses
628 * may use this method to reset specific services under specific instances, but
629 * it should not be exposed to application logic.
631 * @note With proper dependency injection used throughout the codebase, this method
632 * should not be needed. It is provided to allow tests that pollute global service
633 * instances to clean up.
635 * @param string $name
636 * @param bool $destroy Whether the service instance should be destroyed if it exists.
637 * When set to false, any existing service instance will effectively be detached
638 * from the container.
640 public function resetServiceForTesting( $name, $destroy = true ) {
641 if ( !defined( 'MW_PHPUNIT_TEST' ) && !defined( 'MW_PARSER_TEST' ) ) {
642 throw new LogicException( 'resetServiceForTesting() must not be used outside unit tests.' );
645 $this->resetService( $name, $destroy );
649 * Convenience method that throws an exception unless it is called during a phase in which
650 * resetting of global services is allowed. In general, services should not be reset
651 * individually, since that may introduce inconsistencies.
655 * This method will throw an exception if:
657 * - self::$resetInProgress is false (to allow all services to be reset together
658 * via resetGlobalInstance)
659 * - and MEDIAWIKI_INSTALL is not defined (to allow services to be reset during installation)
660 * - and MW_PHPUNIT_TEST is not defined (to allow services to be reset during testing)
662 * This method is intended to be used to safeguard against accidentally resetting
663 * global service instances that are not yet managed by MediaWikiServices. It is
664 * defined here in the MediaWikiServices services class to have a central place
665 * for managing service bootstrapping and resetting.
667 * @param string $method the name of the caller method, as given by __METHOD__.
669 * @see resetGlobalInstance()
670 * @see forceGlobalInstance()
671 * @see disableStorage()
673 public static function failIfResetNotAllowed( $method ) {
674 if ( !defined( 'MW_PHPUNIT_TEST' )
675 && !defined( 'MW_PARSER_TEST' )
676 && !defined( 'MEDIAWIKI_INSTALL' )
677 && !defined( 'RUN_MAINTENANCE_IF_MAIN' )
678 && defined( 'MW_SERVICE_BOOTSTRAP_COMPLETE' )
680 throw new LogicException( $method . ' may only be called during bootstrapping and unit tests!' );
685 * @param Config $config The Config object to be registered as the 'BootstrapConfig' service.
686 * This has to contain at least the information needed to set up the 'ConfigFactory'
689 public function __construct( Config
$config ) {
690 parent
::__construct();
692 // Register the given Config object as the bootstrap config service.
693 $this->defineService( 'BootstrapConfig', static function () use ( $config ) {
698 // CONVENIENCE GETTERS ////////////////////////////////////////////////////
703 public function getActionFactory(): ActionFactory
{
704 return $this->getService( 'ActionFactory' );
710 public function getActorMigration(): ActorMigration
{
711 return $this->getService( 'ActorMigration' );
717 public function getActorNormalization(): ActorNormalization
{
718 return $this->getService( 'ActorNormalization' );
724 public function getActorStore(): ActorStore
{
725 return $this->getService( 'ActorStore' );
731 public function getActorStoreFactory(): ActorStoreFactory
{
732 return $this->getService( 'ActorStoreFactory' );
738 public function getArchivedRevisionLookup(): ArchivedRevisionLookup
{
739 return $this->getService( 'ArchivedRevisionLookup' );
745 public function getAuthManager(): AuthManager
{
746 return $this->getService( 'AuthManager' );
752 public function getAutoblockExemptionList(): AutoblockExemptionList
{
753 return $this->getService( 'AutoblockExemptionList' );
759 public function getBacklinkCacheFactory(): BacklinkCacheFactory
{
760 return $this->getService( 'BacklinkCacheFactory' );
766 public function getBadFileLookup(): BadFileLookup
{
767 return $this->getService( 'BadFileLookup' );
773 public function getBlobStore(): BlobStore
{
774 return $this->getService( 'BlobStore' );
780 public function getBlobStoreFactory(): BlobStoreFactory
{
781 return $this->getService( 'BlobStoreFactory' );
787 public function getBlockActionInfo(): BlockActionInfo
{
788 return $this->getService( 'BlockActionInfo' );
793 * @deprecated since 1.42, use getFormatterFactory()->getBlockErrorFormatter() instead.
795 public function getBlockErrorFormatter(): BlockErrorFormatter
{
796 wfDeprecated( __METHOD__
, '1.42' );
797 return $this->getService( 'BlockErrorFormatter' );
803 public function getBlockManager(): BlockManager
{
804 return $this->getService( 'BlockManager' );
810 public function getBlockPermissionCheckerFactory(): BlockPermissionCheckerFactory
{
811 return $this->getService( 'BlockPermissionCheckerFactory' );
817 public function getBlockRestrictionStore(): BlockRestrictionStore
{
818 return $this->getService( 'BlockRestrictionStore' );
824 public function getBlockRestrictionStoreFactory(): BlockRestrictionStoreFactory
{
825 return $this->getService( 'BlockRestrictionStoreFactory' );
831 public function getBlockUserFactory(): BlockUserFactory
{
832 return $this->getService( 'BlockUserFactory' );
838 public function getBlockUtils(): BlockUtils
{
839 return $this->getService( 'BlockUtils' );
845 public function getBlockUtilsFactory(): BlockUtilsFactory
{
846 return $this->getService( 'BlockUtilsFactory' );
850 * Returns the Config object containing the bootstrap configuration.
851 * Bootstrap configuration would typically include database credentials
852 * and other information that may be needed before the ConfigFactory
853 * service can be instantiated.
855 * @note This should only be used during bootstrapping, in particular
856 * when creating the MainConfig service. Application logic should
857 * use getMainConfig() to get a Config instances.
861 public function getBootstrapConfig(): Config
{
862 return $this->getService( 'BootstrapConfig' );
868 public function getBotPasswordStore(): BotPasswordStore
{
869 return $this->getService( 'BotPasswordStore' );
875 public function getCentralIdLookup(): CentralIdLookup
{
876 return $this->getService( 'CentralIdLookup' );
882 public function getCentralIdLookupFactory(): CentralIdLookupFactory
{
883 return $this->getService( 'CentralIdLookupFactory' );
889 public function getChangeTagDefStore(): NameTableStore
{
890 return $this->getService( 'ChangeTagDefStore' );
896 public function getChangeTagsStore(): ChangeTagsStore
{
897 return $this->getService( 'ChangeTagsStore' );
903 public function getChronologyProtector(): ChronologyProtector
{
904 return $this->getService( 'ChronologyProtector' );
910 public function getCollationFactory(): CollationFactory
{
911 return $this->getService( 'CollationFactory' );
917 public function getCommentFormatter(): CommentFormatter
{
918 return $this->getService( 'CommentFormatter' );
924 public function getCommentParserFactory(): CommentParserFactory
{
925 return $this->getService( 'CommentParserFactory' );
931 public function getCommentStore(): CommentStore
{
932 return $this->getService( 'CommentStore' );
938 public function getConfigFactory(): ConfigFactory
{
939 return $this->getService( 'ConfigFactory' );
943 * @deprecated since 1.42. Unused.
946 public function getConfigRepository(): ConfigRepository
{
947 wfDeprecated( __METHOD__
, '1.42' );
948 return $this->getService( 'ConfigRepository' );
954 public function getConfigSchema(): ConfigSchema
{
955 return $this->getService( 'ConfigSchema' );
960 * @deprecated since 1.41 use ::getReadOnlyMode() instead
962 public function getConfiguredReadOnlyMode(): ConfiguredReadOnlyMode
{
963 return $this->getService( 'ConfiguredReadOnlyMode' );
969 public function getConnectionProvider(): IConnectionProvider
{
970 return $this->getService( 'ConnectionProvider' );
976 public function getContentHandlerFactory(): IContentHandlerFactory
{
977 return $this->getService( 'ContentHandlerFactory' );
983 public function getContentLanguage(): Language
{
984 return $this->getService( 'ContentLanguage' );
990 public function getContentLanguageCode(): LanguageCode
{
991 return $this->getService( 'ContentLanguageCode' );
997 public function getContentModelChangeFactory(): ContentModelChangeFactory
{
998 return $this->getService( 'ContentModelChangeFactory' );
1004 public function getContentModelStore(): NameTableStore
{
1005 return $this->getService( 'ContentModelStore' );
1011 public function getContentRenderer(): ContentRenderer
{
1012 return $this->getService( 'ContentRenderer' );
1018 public function getContentTransformer(): ContentTransformer
{
1019 return $this->getService( 'ContentTransformer' );
1025 public function getCriticalSectionProvider(): CriticalSectionProvider
{
1026 return $this->getService( 'CriticalSectionProvider' );
1032 public function getDatabaseBlockStore(): DatabaseBlockStore
{
1033 return $this->getService( 'DatabaseBlockStore' );
1039 public function getDatabaseBlockStoreFactory(): DatabaseBlockStoreFactory
{
1040 return $this->getService( 'DatabaseBlockStoreFactory' );
1046 public function getDatabaseFactory(): DatabaseFactory
{
1047 return $this->getService( 'DatabaseFactory' );
1053 public function getDateFormatterFactory(): DateFormatterFactory
{
1054 return $this->getService( 'DateFormatterFactory' );
1059 * @return ILoadBalancer The main DB load balancer for the local wiki.
1061 public function getDBLoadBalancer(): ILoadBalancer
{
1062 return $this->getService( 'DBLoadBalancer' );
1067 * @note When possible, use {@link getConnectionProvider()} instead.
1069 public function getDBLoadBalancerFactory(): LBFactory
{
1070 return $this->getService( 'DBLoadBalancerFactory' );
1076 public function getDBLoadBalancerFactoryConfigBuilder(): MWLBFactory
{
1077 return $this->getService( 'DBLoadBalancerFactoryConfigBuilder' );
1081 * @return OutputTransformPipeline
1084 public function getDefaultOutputPipeline(): OutputTransformPipeline
{
1085 return $this->getService( 'DefaultOutputPipeline' );
1091 public function getDeletePageFactory(): DeletePageFactory
{
1092 return $this->getService( 'DeletePageFactory' );
1097 * @unstable until 1.45
1099 public function getDomainEventDispatcher(): DomainEventDispatcher
{
1100 return $this->getService( 'DomainEventDispatcher' );
1105 * @unstable until 1.45
1107 public function getDomainEventSource(): DomainEventSource
{
1108 return $this->getService( 'DomainEventSource' );
1114 public function getEmailer(): IEmailer
{
1115 return $this->getService( 'Emailer' );
1121 public function getEmailUserFactory(): EmailUserFactory
{
1122 return $this->getService( 'EmailUserFactory' );
1128 public function getEventRelayerGroup(): EventRelayerGroup
{
1129 return $this->getService( 'EventRelayerGroup' );
1135 public function getExtensionRegistry(): ExtensionRegistry
{
1136 return $this->getService( 'ExtensionRegistry' );
1142 public function getExternalStoreAccess(): ExternalStoreAccess
{
1143 return $this->getService( 'ExternalStoreAccess' );
1149 public function getExternalStoreFactory(): ExternalStoreFactory
{
1150 return $this->getService( 'ExternalStoreFactory' );
1156 public function getFileBackendGroup(): FileBackendGroup
{
1157 return $this->getService( 'FileBackendGroup' );
1163 public function getFormatterFactory(): FormatterFactory
{
1164 return $this->getService( 'FormatterFactory' );
1170 public function getGenderCache(): GenderCache
{
1171 return $this->getService( 'GenderCache' );
1177 public function getGlobalIdGenerator(): GlobalIdGenerator
{
1178 return $this->getService( 'GlobalIdGenerator' );
1184 public function getGrantsInfo(): GrantsInfo
{
1185 return $this->getService( 'GrantsInfo' );
1191 public function getGrantsLocalization(): GrantsLocalization
{
1192 return $this->getService( 'GrantsLocalization' );
1198 public function getGroupPermissionsLookup(): GroupPermissionsLookup
{
1199 return $this->getService( 'GroupPermissionsLookup' );
1204 * @return HideUserUtils
1206 public function getHideUserUtils(): HideUserUtils
{
1207 return $this->getService( 'HideUserUtils' );
1213 public function getHookContainer(): HookContainer
{
1214 return $this->getService( 'HookContainer' );
1220 public function getHtmlCacheUpdater(): HTMLCacheUpdater
{
1221 return $this->getService( 'HtmlCacheUpdater' );
1227 public function getHtmlTransformFactory(): HtmlTransformFactory
{
1228 return $this->getService( 'HtmlTransformFactory' );
1234 public function getHttpRequestFactory(): HttpRequestFactory
{
1235 return $this->getService( 'HttpRequestFactory' );
1241 public function getInterwikiLookup(): InterwikiLookup
{
1242 return $this->getService( 'InterwikiLookup' );
1248 public function getIntroMessageBuilder(): IntroMessageBuilder
{
1249 return $this->getService( 'IntroMessageBuilder' );
1255 public function getJobFactory(): JobFactory
{
1256 return $this->getService( 'JobFactory' );
1262 public function getJobQueueGroup(): JobQueueGroup
{
1263 return $this->getService( 'JobQueueGroup' );
1269 public function getJobQueueGroupFactory(): JobQueueGroupFactory
{
1270 return $this->getService( 'JobQueueGroupFactory' );
1276 public function getJobRunner(): JobRunner
{
1277 return $this->getService( 'JobRunner' );
1283 public function getJsonCodec(): JsonCodec
{
1284 return $this->getService( 'JsonCodec' );
1290 public function getLanguageConverterFactory(): LanguageConverterFactory
{
1291 return $this->getService( 'LanguageConverterFactory' );
1297 public function getLanguageFactory(): LanguageFactory
{
1298 return $this->getService( 'LanguageFactory' );
1304 public function getLanguageFallback(): LanguageFallback
{
1305 return $this->getService( 'LanguageFallback' );
1311 public function getLanguageNameUtils(): LanguageNameUtils
{
1312 return $this->getService( 'LanguageNameUtils' );
1318 public function getLinkBatchFactory(): LinkBatchFactory
{
1319 return $this->getService( 'LinkBatchFactory' );
1325 public function getLinkCache(): LinkCache
{
1326 return $this->getService( 'LinkCache' );
1330 * LinkRenderer instance that can be used
1331 * if no custom options are needed
1335 public function getLinkRenderer(): LinkRenderer
{
1336 return $this->getService( 'LinkRenderer' );
1342 public function getLinkRendererFactory(): LinkRendererFactory
{
1343 return $this->getService( 'LinkRendererFactory' );
1349 public function getLinksMigration(): LinksMigration
{
1350 return $this->getService( 'LinksMigration' );
1356 public function getLinkTargetLookup(): LinkTargetLookup
{
1357 return $this->getService( 'LinkTargetLookup' );
1363 public function getLintErrorChecker(): LintErrorChecker
{
1364 return $this->getService( 'LintErrorChecker' );
1370 public function getLocalisationCache(): LocalisationCache
{
1371 return $this->getService( 'LocalisationCache' );
1375 * Returns the main server-local cache, yielding EmptyBagOStuff if there is none
1377 * In web request mode, the cache should at least be shared among web workers.
1378 * In CLI mode, the cache should at least be shared among processes run by the same user.
1382 public function getLocalServerObjectCache(): BagOStuff
{
1383 return $this->getService( 'LocalServerObjectCache' );
1389 public function getLockManagerGroupFactory(): LockManagerGroupFactory
{
1390 return $this->getService( 'LockManagerGroupFactory' );
1396 public function getLogFormatterFactory(): LogFormatterFactory
{
1397 return $this->getService( 'LogFormatterFactory' );
1403 public function getMagicWordFactory(): MagicWordFactory
{
1404 return $this->getService( 'MagicWordFactory' );
1408 * Returns the Config object that provides configuration for MediaWiki core.
1409 * This may or may not be the same object that is returned by getBootstrapConfig().
1413 public function getMainConfig(): Config
{
1414 return $this->getService( 'MainConfig' );
1418 * Returns the main object stash, yielding EmptyBagOStuff if there is none
1420 * The stash should be shared among all datacenters
1424 public function getMainObjectStash(): BagOStuff
{
1425 return $this->getService( 'MainObjectStash' );
1429 * Returns the main WAN cache, yielding EmptyBagOStuff if there is none
1431 * The cache should relay any purge operations to all datacenters
1435 public function getMainWANObjectCache(): WANObjectCache
{
1436 return $this->getService( 'MainWANObjectCache' );
1442 public function getMediaHandlerFactory(): MediaHandlerFactory
{
1443 return $this->getService( 'MediaHandlerFactory' );
1449 public function getMergeHistoryFactory(): MergeHistoryFactory
{
1450 return $this->getService( 'MergeHistoryFactory' );
1456 public function getMessageCache(): MessageCache
{
1457 return $this->getService( 'MessageCache' );
1463 public function getMessageFormatterFactory(): IMessageFormatterFactory
{
1464 return $this->getService( 'MessageFormatterFactory' );
1472 public function getMicroStash(): BagOStuff
{
1473 return $this->getService( 'MicroStash' );
1479 public function getMimeAnalyzer(): MimeAnalyzer
{
1480 return $this->getService( 'MimeAnalyzer' );
1486 public function getMovePageFactory(): MovePageFactory
{
1487 return $this->getService( 'MovePageFactory' );
1493 public function getNamespaceInfo(): NamespaceInfo
{
1494 return $this->getService( 'NamespaceInfo' );
1500 public function getNameTableStoreFactory(): NameTableStoreFactory
{
1501 return $this->getService( 'NameTableStoreFactory' );
1506 * @return ObjectCacheFactory
1508 public function getObjectCacheFactory(): ObjectCacheFactory
{
1509 return $this->getService( 'ObjectCacheFactory' );
1513 * ObjectFactory is intended for instantiating "handlers" from declarative definitions,
1514 * such as Action API modules, special pages, or REST API handlers.
1518 public function getObjectFactory(): ObjectFactory
{
1519 return $this->getService( 'ObjectFactory' );
1525 public function getOldRevisionImporter(): OldRevisionImporter
{
1526 return $this->getService( 'OldRevisionImporter' );
1532 public function getPageEditStash(): PageEditStash
{
1533 return $this->getService( 'PageEditStash' );
1539 public function getPageProps(): PageProps
{
1540 return $this->getService( 'PageProps' );
1546 public function getPageRestHelperFactory(): PageRestHelperFactory
{
1547 return $this->getService( 'PageRestHelperFactory' );
1553 public function getPageStore(): PageStore
{
1554 return $this->getService( 'PageStore' );
1560 public function getPageStoreFactory(): PageStoreFactory
{
1561 return $this->getService( 'PageStoreFactory' );
1567 public function getPageUpdaterFactory(): PageUpdaterFactory
{
1568 return $this->getService( 'PageUpdaterFactory' );
1572 * Get the main Parser instance. This is unsafe when the caller is not in
1573 * a top-level context, because re-entering the parser will throw an
1576 * @note Do not use this service for dependency injection or in service wiring.
1577 * It is convenience function to get the global instance in global code.
1578 * For dependency injection or service wiring code use the parser factory via the
1579 * 'ParserFactory' service and call one of the factory functions, preferably
1580 * {@link ParserFactory::create}.
1584 public function getParser(): Parser
{
1585 return $this->getService( 'Parser' );
1591 public function getParserCache(): ParserCache
{
1592 return $this->getService( 'ParserCache' );
1598 public function getParserCacheFactory(): ParserCacheFactory
{
1599 return $this->getService( 'ParserCacheFactory' );
1605 public function getParserFactory(): ParserFactory
{
1606 return $this->getService( 'ParserFactory' );
1612 public function getParserOutputAccess(): ParserOutputAccess
{
1613 return $this->getService( 'ParserOutputAccess' );
1620 public function getParsoidDataAccess(): DataAccess
{
1621 return $this->getService( 'ParsoidDataAccess' );
1626 * @unstable since 1.39, should be stable before release of 1.39
1628 public function getParsoidOutputStash(): ParsoidOutputStash
{
1629 return $this->getService( 'ParsoidOutputStash' );
1636 public function getParsoidPageConfigFactory(): PageConfigFactory
{
1637 return $this->getService( 'ParsoidPageConfigFactory' );
1644 public function getParsoidParserFactory(): ParsoidParserFactory
{
1645 return $this->getService( 'ParsoidParserFactory' );
1652 public function getParsoidSiteConfig(): SiteConfig
{
1653 return $this->getService( 'ParsoidSiteConfig' );
1659 public function getPasswordFactory(): PasswordFactory
{
1660 return $this->getService( 'PasswordFactory' );
1666 public function getPasswordReset(): PasswordReset
{
1667 return $this->getService( 'PasswordReset' );
1673 public function getPerDbNameStatsdDataFactory(): StatsdDataFactoryInterface
{
1674 return $this->getService( 'PerDbNameStatsdDataFactory' );
1680 public function getPermissionManager(): PermissionManager
{
1681 return $this->getService( 'PermissionManager' );
1688 public function getPingback(): Pingback
{
1689 return $this->getService( 'Pingback' );
1695 public function getPoolCounterFactory(): PoolCounterFactory
{
1696 return $this->getService( 'PoolCounterFactory' );
1702 public function getPreferencesFactory(): PreferencesFactory
{
1703 return $this->getService( 'PreferencesFactory' );
1709 public function getPreloadedContentBuilder(): PreloadedContentBuilder
{
1710 return $this->getService( 'PreloadedContentBuilder' );
1716 public function getProxyLookup(): ProxyLookup
{
1717 return $this->getService( 'ProxyLookup' );
1723 public function getRateLimiter(): RateLimiter
{
1724 return $this->getService( 'RateLimiter' );
1730 public function getReadOnlyMode(): ReadOnlyMode
{
1731 return $this->getService( 'ReadOnlyMode' );
1737 public function getRedirectLookup(): RedirectLookup
{
1738 return $this->getService( 'RedirectLookup' );
1744 public function getRedirectStore(): RedirectStore
{
1745 return $this->getService( 'RedirectStore' );
1751 public function getRepoGroup(): RepoGroup
{
1752 return $this->getService( 'RepoGroup' );
1758 public function getResourceLoader(): ResourceLoader
{
1759 return $this->getService( 'ResourceLoader' );
1765 public function getRestrictionStore(): RestrictionStore
{
1766 return $this->getService( 'RestrictionStore' );
1772 public function getRevertedTagUpdateManager(): RevertedTagUpdateManager
{
1773 return $this->getService( 'RevertedTagUpdateManager' );
1779 public function getRevisionFactory(): RevisionFactory
{
1780 return $this->getService( 'RevisionFactory' );
1786 public function getRevisionLookup(): RevisionLookup
{
1787 return $this->getService( 'RevisionLookup' );
1793 public function getRevisionRenderer(): RevisionRenderer
{
1794 return $this->getService( 'RevisionRenderer' );
1800 public function getRevisionStore(): RevisionStore
{
1801 return $this->getService( 'RevisionStore' );
1807 public function getRevisionStoreFactory(): RevisionStoreFactory
{
1808 return $this->getService( 'RevisionStoreFactory' );
1814 public function getRollbackPageFactory(): RollbackPageFactory
{
1815 return $this->getService( 'RollbackPageFactory' );
1821 public function getRowCommentFormatter(): RowCommentFormatter
{
1822 return $this->getService( 'RowCommentFormatter' );
1828 public function newSearchEngine(): SearchEngine
{
1829 // New engine object every time, since they keep state
1830 return $this->getService( 'SearchEngineFactory' )->create();
1836 public function getSearchEngineConfig(): SearchEngineConfig
{
1837 return $this->getService( 'SearchEngineConfig' );
1843 public function getSearchEngineFactory(): SearchEngineFactory
{
1844 return $this->getService( 'SearchEngineFactory' );
1850 public function getSearchResultThumbnailProvider(): SearchResultThumbnailProvider
{
1851 return $this->getService( 'SearchResultThumbnailProvider' );
1857 public function getSessionManager(): SessionManager
{
1858 return $this->getService( 'SessionManager' );
1864 public function getShellboxClientFactory(): ShellboxClientFactory
{
1865 return $this->getService( 'ShellboxClientFactory' );
1871 public function getShellCommandFactory(): CommandFactory
{
1872 return $this->getService( 'ShellCommandFactory' );
1878 public function getSignatureValidatorFactory(): SignatureValidatorFactory
{
1879 return $this->getService( 'SignatureValidatorFactory' );
1885 public function getSiteLookup(): SiteLookup
{
1886 return $this->getService( 'SiteLookup' );
1892 public function getSiteStore(): SiteStore
{
1893 return $this->getService( 'SiteStore' );
1899 public function getSkinFactory(): SkinFactory
{
1900 return $this->getService( 'SkinFactory' );
1906 public function getSlotRoleRegistry(): SlotRoleRegistry
{
1907 return $this->getService( 'SlotRoleRegistry' );
1913 public function getSlotRoleStore(): NameTableStore
{
1914 return $this->getService( 'SlotRoleStore' );
1920 public function getSpamChecker(): SpamChecker
{
1921 return $this->getService( 'SpamChecker' );
1927 public function getSpecialPageFactory(): SpecialPageFactory
{
1928 return $this->getService( 'SpecialPageFactory' );
1934 public function getStatsdDataFactory(): IBufferingStatsdDataFactory
{
1935 return $this->getService( 'StatsdDataFactory' );
1941 public function getStatsFactory(): StatsFactory
{
1942 return $this->getService( 'StatsFactory' );
1948 public function getTalkPageNotificationManager(): TalkPageNotificationManager
{
1949 return $this->getService( 'TalkPageNotificationManager' );
1955 public function getTempFSFileFactory(): TempFSFileFactory
{
1956 return $this->getService( 'TempFSFileFactory' );
1962 public function getTempUserConfig(): RealTempUserConfig
{
1963 return $this->getService( 'TempUserConfig' );
1969 public function getTempUserCreator(): TempUserCreator
{
1970 return $this->getService( 'TempUserCreator' );
1976 public function getTidy(): TidyDriverBase
{
1977 return $this->getService( 'Tidy' );
1983 public function getTitleFactory(): TitleFactory
{
1984 return $this->getService( 'TitleFactory' );
1990 public function getTitleFormatter(): TitleFormatter
{
1991 return $this->getService( 'TitleFormatter' );
1997 public function getTitleMatcher(): TitleMatcher
{
1998 return $this->getService( 'TitleMatcher' );
2004 public function getTitleParser(): TitleParser
{
2005 return $this->getService( 'TitleParser' );
2008 public function getTracer(): TracerInterface
{
2009 return $this->getService( 'Tracer' );
2015 public function getTrackingCategories(): TrackingCategories
{
2016 return $this->getService( 'TrackingCategories' );
2022 public function getUnblockUserFactory(): UnblockUserFactory
{
2023 return $this->getService( 'UnblockUserFactory' );
2029 public function getUndeletePageFactory(): UndeletePageFactory
{
2030 return $this->getService( 'UndeletePageFactory' );
2036 public function getUploadRevisionImporter(): UploadRevisionImporter
{
2037 return $this->getService( 'UploadRevisionImporter' );
2043 public function getUrlUtils(): UrlUtils
{
2044 return $this->getService( 'UrlUtils' );
2049 * @deprecated since 1.43, use ActorStore
2051 public function getUserCache(): UserCache
{
2052 return $this->getService( 'UserCache' );
2058 public function getUserEditTracker(): UserEditTracker
{
2059 return $this->getService( 'UserEditTracker' );
2065 public function getUserFactory(): UserFactory
{
2066 return $this->getService( 'UserFactory' );
2072 public function getUserGroupManager(): UserGroupManager
{
2073 return $this->getService( 'UserGroupManager' );
2079 public function getUserGroupManagerFactory(): UserGroupManagerFactory
{
2080 return $this->getService( 'UserGroupManagerFactory' );
2086 public function getUserIdentityLookup(): UserIdentityLookup
{
2087 return $this->getService( 'UserIdentityLookup' );
2093 public function getUserIdentityUtils(): UserIdentityUtils
{
2094 return $this->getService( 'UserIdentityUtils' );
2100 public function getUserNamePrefixSearch(): UserNamePrefixSearch
{
2101 return $this->getService( 'UserNamePrefixSearch' );
2107 public function getUserNameUtils(): UserNameUtils
{
2108 return $this->getService( 'UserNameUtils' );
2114 public function getUserOptionsLookup(): UserOptionsLookup
{
2115 return $this->getService( 'UserOptionsLookup' );
2121 public function getUserOptionsManager(): UserOptionsManager
{
2122 return $this->getService( 'UserOptionsManager' );
2128 public function getUserRegistrationLookup(): UserRegistrationLookup
{
2129 return $this->getService( 'UserRegistrationLookup' );
2135 public function getWatchedItemQueryService(): WatchedItemQueryService
{
2136 return $this->getService( 'WatchedItemQueryService' );
2142 public function getWatchedItemStore(): WatchedItemStoreInterface
{
2143 return $this->getService( 'WatchedItemStore' );
2149 public function getWatchlistManager(): WatchlistManager
{
2150 return $this->getService( 'WatchlistManager' );
2156 public function getWikiExporterFactory(): WikiExporterFactory
{
2157 return $this->getService( 'WikiExporterFactory' );
2163 public function getWikiImporterFactory(): WikiImporterFactory
{
2164 return $this->getService( 'WikiImporterFactory' );
2170 public function getWikiPageFactory(): WikiPageFactory
{
2171 return $this->getService( 'WikiPageFactory' );
2177 public function getWikiRevisionOldRevisionImporter(): OldRevisionImporter
{
2178 return $this->getService( 'OldRevisionImporter' );
2184 public function getWikiRevisionOldRevisionImporterNoUpdates(): OldRevisionImporter
{
2185 return $this->getService( 'WikiRevisionOldRevisionImporterNoUpdates' );
2191 public function getWikiRevisionUploadImporter(): UploadRevisionImporter
{
2192 return $this->getService( 'UploadRevisionImporter' );
2198 public function getWRStatsFactory(): WRStatsFactory
{
2199 return $this->getService( 'WRStatsFactory' );