MediaWiki REL1_40
ServiceWiring.php
Go to the documentation of this file.
1<?php
44use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
200use Wikimedia\ObjectFactory\ObjectFactory;
201use Wikimedia\Parsoid\Config\Api\DataAccess as ApiDataAccess;
202use Wikimedia\Parsoid\Config\Api\SiteConfig as ApiSiteConfig;
203use Wikimedia\Parsoid\Config\DataAccess;
204use Wikimedia\Parsoid\Config\SiteConfig;
205use Wikimedia\Parsoid\Parsoid;
207use Wikimedia\RequestTimeout\CriticalSectionProvider;
208use Wikimedia\RequestTimeout\RequestTimeout;
209use Wikimedia\Services\RecursiveServiceDependencyException;
215
217return [
218 'ActionFactory' => static function ( MediaWikiServices $services ): ActionFactory {
220 $services->getMainConfig()->get( MainConfigNames::Actions ),
221 LoggerFactory::getInstance( 'ActionFactory' ),
222 $services->getObjectFactory(),
223 $services->getHookContainer()
224 );
225 },
226
227 'ActorMigration' => static function ( MediaWikiServices $services ): ActorMigration {
230 $services->getActorStoreFactory()
231 );
232 },
233
234 'ActorNormalization' => static function ( MediaWikiServices $services ): ActorNormalization {
235 return $services->getActorStoreFactory()->getActorNormalization();
236 },
237
238 'ActorStore' => static function ( MediaWikiServices $services ): ActorStore {
239 return $services->getActorStoreFactory()->getActorStore();
240 },
241
242 'ActorStoreFactory' => static function ( MediaWikiServices $services ): ActorStoreFactory {
244 new ServiceOptions( ActorStoreFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
245 $services->getDBLoadBalancerFactory(),
246 $services->getUserNameUtils(),
247 LoggerFactory::getInstance( 'ActorStore' )
248 );
249 },
250
251 'ArchivedRevisionLookup' => static function ( MediaWikiServices $services ): ArchivedRevisionLookup {
253 $services->getDBLoadBalancer(),
254 $services->getRevisionStore()
255 );
256 },
257
258 'AuthManager' => static function ( MediaWikiServices $services ): AuthManager {
259 $authManager = new AuthManager(
260 RequestContext::getMain()->getRequest(),
261 $services->getMainConfig(),
262 $services->getObjectFactory(),
263 $services->getHookContainer(),
264 $services->getReadOnlyMode(),
265 $services->getUserNameUtils(),
266 $services->getBlockManager(),
267 $services->getWatchlistManager(),
268 $services->getDBLoadBalancer(),
269 $services->getContentLanguage(),
270 $services->getLanguageConverterFactory(),
271 $services->getBotPasswordStore(),
272 $services->getUserFactory(),
273 $services->getUserIdentityLookup(),
274 $services->getUserOptionsManager()
275 );
276 $authManager->setLogger( LoggerFactory::getInstance( 'authentication' ) );
277 return $authManager;
278 },
279
280 'BacklinkCacheFactory' => static function ( MediaWikiServices $services ): BacklinkCacheFactory {
282 $services->getMainWANObjectCache(),
283 $services->getHookContainer()
284 );
285 },
286
287 'BadFileLookup' => static function ( MediaWikiServices $services ): BadFileLookup {
289 static function () {
290 return wfMessage( 'bad_image_list' )->inContentLanguage()->plain();
291 },
292 $services->getLocalServerObjectCache(),
293 $services->getRepoGroup(),
294 $services->getTitleParser(),
295 $services->getHookContainer()
296 );
297 },
298
299 'BlobStore' => static function ( MediaWikiServices $services ): BlobStore {
300 return $services->getService( '_SqlBlobStore' );
301 },
302
303 'BlobStoreFactory' => static function ( MediaWikiServices $services ): BlobStoreFactory {
305 $services->getDBLoadBalancerFactory(),
306 $services->getExternalStoreAccess(),
307 $services->getMainWANObjectCache(),
308 new ServiceOptions( BlobStoreFactory::CONSTRUCTOR_OPTIONS,
309 $services->getMainConfig() )
310 );
311 },
312
313 'BlockActionInfo' => static function ( MediaWikiServices $services ): BlockActionInfo {
314 return new BlockActionInfo( $services->getHookContainer() );
315 },
316
317 'BlockErrorFormatter' => static function ( MediaWikiServices $services ): BlockErrorFormatter {
319 $services->getTitleFormatter(),
320 $services->getHookContainer(),
321 $services->getUserNameUtils()
322 );
323 },
324
325 'BlockManager' => static function ( MediaWikiServices $services ): BlockManager {
327 new ServiceOptions(
328 BlockManager::CONSTRUCTOR_OPTIONS,
329 $services->getMainConfig()
330 ),
331 $services->getPermissionManager(),
332 $services->getUserFactory(),
333 LoggerFactory::getInstance( 'BlockManager' ),
334 $services->getHookContainer()
335 );
336 },
337
338 'BlockPermissionCheckerFactory' => static function (
339 MediaWikiServices $services
342 new ServiceOptions(
343 BlockPermissionCheckerFactory::CONSTRUCTOR_OPTIONS,
344 $services->getMainConfig()
345 ),
346 $services->getBlockUtils()
347 );
348 },
349
350 'BlockRestrictionStore' => static function ( MediaWikiServices $services ): BlockRestrictionStore {
351 return $services->getBlockRestrictionStoreFactory()->getBlockRestrictionStore( WikiAwareEntity::LOCAL );
352 },
353
354 'BlockRestrictionStoreFactory' => static function ( MediaWikiServices $services ): BlockRestrictionStoreFactory {
356 $services->getDBLoadBalancerFactory()
357 );
358 },
359
360 'BlockUserFactory' => static function ( MediaWikiServices $services ): BlockUserFactory {
361 return $services->getService( '_UserBlockCommandFactory' );
362 },
363
364 'BlockUtils' => static function ( MediaWikiServices $services ): BlockUtils {
365 return new BlockUtils(
366 new ServiceOptions(
367 BlockUtils::CONSTRUCTOR_OPTIONS,
368 $services->getMainConfig()
369 ),
370 $services->getUserIdentityLookup(),
371 $services->getUserNameUtils()
372 );
373 },
374
375 'BotPasswordStore' => static function ( MediaWikiServices $services ): BotPasswordStore {
377 new ServiceOptions(
378 BotPasswordStore::CONSTRUCTOR_OPTIONS,
379 $services->getMainConfig()
380 ),
381 $services->getCentralIdLookup(),
382 $services->getDBLoadBalancerFactory()
383 );
384 },
385
386 'CentralIdLookup' => static function ( MediaWikiServices $services ): CentralIdLookup {
387 return $services->getCentralIdLookupFactory()->getLookup();
388 },
389
390 'CentralIdLookupFactory' => static function ( MediaWikiServices $services ): CentralIdLookupFactory {
392 new ServiceOptions( CentralIdLookupFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
393 $services->getObjectFactory(),
394 $services->getUserIdentityLookup()
395 );
396 },
397
398 'ChangeTagDefStore' => static function ( MediaWikiServices $services ): NameTableStore {
399 return $services->getNameTableStoreFactory()->getChangeTagDef();
400 },
401
402 'CollationFactory' => static function ( MediaWikiServices $services ): CollationFactory {
404 new ServiceOptions(
405 CollationFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
406 $services->getObjectFactory(),
407 $services->getHookContainer()
408 );
409 },
410
411 'CommentFormatter' => static function ( MediaWikiServices $services ): CommentFormatter {
412 $linkRenderer = $services->getLinkRendererFactory()->create( [ 'renderForComment' => true ] );
413 $parserFactory = new CommentParserFactory(
414 $linkRenderer,
415 $services->getLinkBatchFactory(),
416 $services->getLinkCache(),
417 $services->getRepoGroup(),
418 RequestContext::getMain()->getLanguage(),
419 $services->getContentLanguage(),
420 $services->getTitleParser(),
421 $services->getNamespaceInfo(),
422 $services->getHookContainer()
423 );
424 return new CommentFormatter( $parserFactory );
425 },
426
427 'CommentStore' => static function ( MediaWikiServices $services ): CommentStore {
429 $services->getContentLanguage(),
431 $services->getMainConfig()->get( MainConfigNames::CommentTempTableSchemaMigrationStage )
432 );
433 },
434
435 'ConfigFactory' => static function ( MediaWikiServices $services ): ConfigFactory {
436 // Use the bootstrap config to initialize the ConfigFactory.
437 $registry = $services->getBootstrapConfig()->get( MainConfigNames::ConfigRegistry );
438 $factory = new ConfigFactory();
439
440 foreach ( $registry as $name => $callback ) {
441 $factory->register( $name, $callback );
442 }
443 return $factory;
444 },
445
446 'ConfigRepository' => static function ( MediaWikiServices $services ): ConfigRepository {
447 return new ConfigRepository( $services->getConfigFactory() );
448 },
449
450 'ConfigSchema' => static function ( MediaWikiServices $services ): ConfigSchema {
452 $settings = $services->get( '_SettingsBuilder' );
453 return $settings->getConfigSchema();
454 },
455
456 'ConfiguredReadOnlyMode' => static function ( MediaWikiServices $services ): ConfiguredReadOnlyMode {
457 $config = $services->getMainConfig();
458 return new ConfiguredReadOnlyMode(
459 $config->get( MainConfigNames::ReadOnly ),
460 $config->get( MainConfigNames::ReadOnlyFile )
461 );
462 },
463
464 'ContentHandlerFactory' => static function ( MediaWikiServices $services ): IContentHandlerFactory {
465 $contentHandlerConfig = $services->getMainConfig()->get( MainConfigNames::ContentHandlers );
466
467 return new ContentHandlerFactory(
468 $contentHandlerConfig,
469 $services->getObjectFactory(),
470 $services->getHookContainer(),
471 LoggerFactory::getInstance( 'ContentHandler' )
472 );
473 },
474
475 'ContentLanguage' => static function ( MediaWikiServices $services ): Language {
476 return $services->getLanguageFactory()->getLanguage(
477 $services->getMainConfig()->get( MainConfigNames::LanguageCode ) );
478 },
479
480 'ContentModelChangeFactory' => static function ( MediaWikiServices $services ): ContentModelChangeFactory {
481 return $services->getService( '_PageCommandFactory' );
482 },
483
484 'ContentModelStore' => static function ( MediaWikiServices $services ): NameTableStore {
485 return $services->getNameTableStoreFactory()->getContentModels();
486 },
487
488 'ContentRenderer' => static function ( MediaWikiServices $services ): ContentRenderer {
489 return new ContentRenderer( $services->getContentHandlerFactory() );
490 },
491
492 'ContentTransformer' => static function ( MediaWikiServices $services ): ContentTransformer {
493 return new ContentTransformer( $services->getContentHandlerFactory() );
494 },
495
496 'ContributionsLookup' => static function ( MediaWikiServices $services ): ContributionsLookup {
498 $services->getRevisionStore(),
499 $services->getLinkRendererFactory(),
500 $services->getLinkBatchFactory(),
501 $services->getHookContainer(),
502 $services->getDBLoadBalancer(),
503 $services->getActorMigration(),
504 $services->getNamespaceInfo(),
505 $services->getCommentFormatter()
506 );
507 },
508
509 'CriticalSectionProvider' => static function ( MediaWikiServices $services ): CriticalSectionProvider {
510 $config = $services->getMainConfig();
511 $limit = $GLOBALS[ 'wgCommandLineMode' ] ? INF : $config->get( MainConfigNames::CriticalSectionTimeLimit );
512 return RequestTimeout::singleton()->createCriticalSectionProvider( $limit );
513 },
514
515 'CryptHKDF' => static function ( MediaWikiServices $services ): CryptHKDF {
516 $config = $services->getMainConfig();
517
518 $secret = $config->get( MainConfigNames::HKDFSecret ) ?: $config->get( MainConfigNames::SecretKey );
519 if ( !$secret ) {
520 throw new RuntimeException( "Cannot use MWCryptHKDF without a secret." );
521 }
522
523 // In HKDF, the context can be known to the attacker, but this will
524 // keep simultaneous runs from producing the same output.
525 $context = [ microtime(), getmypid(), gethostname() ];
526
527 // Setup salt cache. Use APC, or fallback to the main cache if it isn't setup
528 $cache = $services->getLocalServerObjectCache();
529 if ( $cache instanceof EmptyBagOStuff ) {
531 }
532
533 return new CryptHKDF( $secret, $config->get( MainConfigNames::HKDFAlgorithm ), $cache, $context );
534 },
535
536 'DatabaseBlockStore' => static function ( MediaWikiServices $services ): DatabaseBlockStore {
537 return $services->getDatabaseBlockStoreFactory()->getDatabaseBlockStore( DatabaseBlock::LOCAL );
538 },
539
540 'DatabaseBlockStoreFactory' => static function ( MediaWikiServices $services ): DatabaseBlockStoreFactory {
542 new ServiceOptions(
543 DatabaseBlockStoreFactory::CONSTRUCTOR_OPTIONS,
544 $services->getMainConfig()
545 ),
546 LoggerFactory::getInstance( 'DatabaseBlockStore' ),
547 $services->getActorStoreFactory(),
548 $services->getBlockRestrictionStoreFactory(),
549 $services->getCommentStore(),
550 $services->getHookContainer(),
551 $services->getDBLoadBalancerFactory(),
552 $services->getConfiguredReadOnlyMode(),
553 $services->getUserFactory()
554 );
555 },
556
557 'DatabaseFactory' => static function ( MediaWikiServices $services ): DatabaseFactory {
559 },
560
561 'DateFormatterFactory' => static function ( MediaWikiServices $services ): DateFormatterFactory {
563 },
564
565 'DBLoadBalancer' => static function ( MediaWikiServices $services ): Wikimedia\Rdbms\ILoadBalancer {
566 // just return the default LB from the DBLoadBalancerFactory service
567 return $services->getDBLoadBalancerFactory()->getMainLB();
568 },
569
570 'DBLoadBalancerFactory' =>
571 static function ( MediaWikiServices $services ): Wikimedia\Rdbms\LBFactory {
572 $mainConfig = $services->getMainConfig();
573 $lbFactoryConfigBuilder = $services->getDBLoadBalancerFactoryConfigBuilder();
574
575 $lbConf = $lbFactoryConfigBuilder->applyDefaultConfig(
576 $mainConfig->get( MainConfigNames::LBFactoryConf )
577 );
578
579 $class = $lbFactoryConfigBuilder->getLBFactoryClass( $lbConf );
580 $instance = new $class( $lbConf );
581
582 $lbFactoryConfigBuilder->setDomainAliases( $instance );
583
584 // NOTE: This accesses ProxyLookup from the MediaWikiServices singleton
585 // for non-essential non-nonimal purposes (via WebRequest::getIP).
586 // This state is fine (and meant) to be consistent for a given PHP process,
587 // even if applied to the service container for a different wiki.
588 $lbFactoryConfigBuilder->applyGlobalState(
589 $instance,
590 $mainConfig,
591 $services->getStatsdDataFactory()
592 );
593
594 return $instance;
595 },
596
597 'DBLoadBalancerFactoryConfigBuilder' => static function ( MediaWikiServices $services ): MWLBFactory {
598 $cpStashType = $services->getMainConfig()->get( MainConfigNames::ChronologyProtectorStash );
599 if ( is_string( $cpStashType ) ) {
600 $cpStash = ObjectCache::getInstance( $cpStashType );
601 } else {
602 try {
604 } catch ( RecursiveServiceDependencyException $e ) {
605 $cpStash = new EmptyBagOStuff(); // T141804: handle cases like CACHE_DB
606 }
607 }
608
609 try {
610 $wanCache = $services->getMainWANObjectCache();
611 } catch ( RecursiveServiceDependencyException $e ) {
612 $wanCache = WANObjectCache::newEmpty(); // T141804: handle cases like CACHE_DB
613 }
614
615 $srvCache = $services->getLocalServerObjectCache();
616 if ( $srvCache instanceof EmptyBagOStuff ) {
617 // Use process cache if no APCU or other local-server cache (e.g. on CLI)
618 $srvCache = new HashBagOStuff( [ 'maxKeys' => 100 ] );
619 }
620 return new MWLBFactory(
621 new ServiceOptions( MWLBFactory::APPLY_DEFAULT_CONFIG_OPTIONS, $services->getMainConfig() ),
622 $services->getConfiguredReadOnlyMode(),
623 $cpStash,
624 $srvCache,
625 $wanCache,
626 $services->getCriticalSectionProvider(),
627 $services->getStatsdDataFactory(),
628 $services->getDatabaseFactory()
629 );
630 },
631
632 'DeletePageFactory' => static function ( MediaWikiServices $services ): DeletePageFactory {
633 return $services->getService( '_PageCommandFactory' );
634 },
635
636 'Emailer' => static function ( MediaWikiServices $services ): IEmailer {
637 return new Emailer();
638 },
639
640 'EventRelayerGroup' => static function ( MediaWikiServices $services ): EventRelayerGroup {
641 return new EventRelayerGroup( $services->getMainConfig()->get( MainConfigNames::EventRelayerConfig ) );
642 },
643
644 'ExternalStoreAccess' => static function ( MediaWikiServices $services ): ExternalStoreAccess {
646 $services->getExternalStoreFactory(),
647 LoggerFactory::getInstance( 'ExternalStore' )
648 );
649 },
650
651 'ExternalStoreFactory' => static function ( MediaWikiServices $services ): ExternalStoreFactory {
652 $config = $services->getMainConfig();
653 $writeStores = $config->get( MainConfigNames::DefaultExternalStore );
654
655 return new ExternalStoreFactory(
656 $config->get( MainConfigNames::ExternalStores ),
657 ( $writeStores !== false ) ? (array)$writeStores : [],
658 $services->getDBLoadBalancer()->getLocalDomainID(),
659 LoggerFactory::getInstance( 'ExternalStore' )
660 );
661 },
662
663 'FileBackendGroup' => static function ( MediaWikiServices $services ): FileBackendGroup {
664 $mainConfig = $services->getMainConfig();
665
666 $ld = WikiMap::getCurrentWikiDbDomain();
667 $fallbackWikiId = WikiMap::getWikiIdFromDbDomain( $ld );
668 // If the local wiki ID and local domain ID do not match, probably due to a non-default
669 // schema, issue a warning. A non-default schema indicates that it might be used to
670 // disambiguate different wikis.
671 $legacyDomainId = strlen( $ld->getTablePrefix() )
672 ? "{$ld->getDatabase()}-{$ld->getTablePrefix()}"
673 : $ld->getDatabase();
674 if ( $ld->getSchema() !== null && $legacyDomainId !== $fallbackWikiId ) {
675 wfWarn(
676 "Legacy default 'domainId' is '$legacyDomainId' but wiki ID is '$fallbackWikiId'."
677 );
678 }
679
680 $cache = $services->getLocalServerObjectCache();
681 if ( $cache instanceof EmptyBagOStuff ) {
682 $cache = new HashBagOStuff();
683 }
684
685 return new FileBackendGroup(
686 new ServiceOptions( FileBackendGroup::CONSTRUCTOR_OPTIONS, $mainConfig,
687 [ 'fallbackWikiId' => $fallbackWikiId ] ),
688 $services->getConfiguredReadOnlyMode(),
689 $cache,
690 $services->getMainWANObjectCache(),
691 $services->getMimeAnalyzer(),
692 $services->getLockManagerGroupFactory(),
693 $services->getTempFSFileFactory(),
694 $services->getObjectFactory()
695 );
696 },
697
698 'GenderCache' => static function ( MediaWikiServices $services ): GenderCache {
699 $nsInfo = $services->getNamespaceInfo();
700 // Database layer may be disabled, so processing without database connection
701 $dbLoadBalancer = $services->isServiceDisabled( 'DBLoadBalancer' )
702 ? null
703 : $services->getDBLoadBalancer();
704 return new GenderCache( $nsInfo, $dbLoadBalancer, $services->get( '_DefaultOptionsLookup' ) );
705 },
706
707 'GlobalIdGenerator' => static function ( MediaWikiServices $services ): GlobalIdGenerator {
708 $mainConfig = $services->getMainConfig();
709
710 return new GlobalIdGenerator(
711 $mainConfig->get( MainConfigNames::TmpDirectory ),
712 static function ( $command ) {
713 return wfShellExec( $command );
714 }
715 );
716 },
717
718 'GrantsInfo' => static function ( MediaWikiServices $services ): GrantsInfo {
719 return new GrantsInfo(
720 new ServiceOptions(
721 GrantsInfo::CONSTRUCTOR_OPTIONS,
722 $services->getMainConfig()
723 )
724 );
725 },
726
727 'GrantsLocalization' => static function ( MediaWikiServices $services ): GrantsLocalization {
729 $services->getGrantsInfo(),
730 $services->getLinkRenderer(),
731 $services->getLanguageFactory(),
732 $services->getContentLanguage()
733 );
734 },
735
736 'GroupPermissionsLookup' => static function ( MediaWikiServices $services ): GroupPermissionsLookup {
738 new ServiceOptions( GroupPermissionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig() )
739 );
740 },
741
742 'HookContainer' => static function ( MediaWikiServices $services ): HookContainer {
743 // NOTE: This is called while $services is being initialized, in order to call the
744 // MediaWikiServices hook.
745
746 $configHooks = $services->getBootstrapConfig()->get( MainConfigNames::Hooks );
747
748 // If we are instantiating this service after $wgHooks was replaced by a fake,
749 // get the original array out of the object. This should only happen in the installer,
750 // when it calls resetMediaWikiServices().
751 if ( $configHooks instanceof FauxGlobalHookArray ) {
752 $configHooks = $configHooks->getOriginalArray();
753 }
754
755 $extRegistry = ExtensionRegistry::getInstance();
756 $extHooks = $extRegistry->getAttribute( 'Hooks' );
757 $extDeprecatedHooks = $extRegistry->getAttribute( 'DeprecatedHooks' );
758
759 $hookRegistry = new StaticHookRegistry( $configHooks, $extHooks, $extDeprecatedHooks );
760 $hookContainer = new HookContainer(
761 $hookRegistry,
762 $services->getObjectFactory()
763 );
764
765 return $hookContainer;
766 },
767
768 'HtmlCacheUpdater' => static function ( MediaWikiServices $services ): HtmlCacheUpdater {
769 $config = $services->getMainConfig();
770
771 return new HtmlCacheUpdater(
772 $services->getHookContainer(),
773 $services->getTitleFactory(),
774 $config->get( MainConfigNames::CdnReboundPurgeDelay ),
775 $config->get( MainConfigNames::UseFileCache ),
776 $config->get( MainConfigNames::CdnMaxAge )
777 );
778 },
779
780 'HtmlTransformFactory' => static function ( MediaWikiServices $services ): HtmlTransformFactory {
782 $services->getService( '_Parsoid' ),
783 $services->getMainConfig()->get( MainConfigNames::ParsoidSettings ),
784 $services->getParsoidPageConfigFactory(),
785 $services->getContentHandlerFactory(),
786 $services->getParsoidSiteConfig(),
787 $services->getTitleFactory(),
788 $services->getLanguageConverterFactory(),
789 $services->getLanguageFactory()
790 );
791 },
792
793 'HttpRequestFactory' =>
794 static function ( MediaWikiServices $services ): HttpRequestFactory {
796 new ServiceOptions(
797 HttpRequestFactory::CONSTRUCTOR_OPTIONS,
798 $services->getMainConfig()
799 ),
800 LoggerFactory::getInstance( 'http' )
801 );
802 },
803
804 'InterwikiLookup' => static function ( MediaWikiServices $services ): InterwikiLookup {
806 new ServiceOptions(
807 ClassicInterwikiLookup::CONSTRUCTOR_OPTIONS,
808 $services->getMainConfig(),
809 [ 'wikiId' => WikiMap::getCurrentWikiId() ]
810 ),
811 $services->getContentLanguage(),
812 $services->getMainWANObjectCache(),
813 $services->getHookContainer(),
814 $services->getDBLoadBalancer()
815 );
816 },
817
818 'JobFactory' => static function ( MediaWikiServices $services ): JobFactory {
819 return new JobFactory(
820 $services->getObjectFactory(),
821 $services->getMainConfig()->get( MainConfigNames::JobClasses )
822 );
823 },
824
825 'JobQueueGroup' => static function ( MediaWikiServices $services ): JobQueueGroup {
826 return $services->getJobQueueGroupFactory()->makeJobQueueGroup();
827 },
828
829 'JobQueueGroupFactory' => static function ( MediaWikiServices $services ): JobQueueGroupFactory {
831 new ServiceOptions( JobQueueGroupFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
832 $services->getConfiguredReadOnlyMode(),
833 $services->getStatsdDataFactory(),
834 $services->getMainWANObjectCache(),
835 $services->getGlobalIdGenerator()
836 );
837 },
838
839 'JobRunner' => static function ( MediaWikiServices $services ): JobRunner {
840 return new JobRunner(
841 new ServiceOptions( JobRunner::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
842 $services->getDBLoadBalancerFactory(),
843 $services->getJobQueueGroup(),
844 $services->getReadOnlyMode(),
845 $services->getLinkCache(),
846 $services->getStatsdDataFactory(),
847 LoggerFactory::getInstance( 'runJobs' )
848 );
849 },
850
851 'JsonCodec' => static function ( MediaWikiServices $services ): JsonCodec {
852 return new JsonCodec();
853 },
854
855 'LanguageConverterFactory' => static function ( MediaWikiServices $services ): LanguageConverterFactory {
856 $usePigLatinVariant = $services->getMainConfig()->get( MainConfigNames::UsePigLatinVariant );
857 $isConversionDisabled = $services->getMainConfig()->get( MainConfigNames::DisableLangConversion );
858 $isTitleConversionDisabled = $services->getMainConfig()->get( MainConfigNames::DisableTitleConversion );
859 return new LanguageConverterFactory(
860 $services->getObjectFactory(),
861 $usePigLatinVariant,
862 $isConversionDisabled,
863 $isTitleConversionDisabled,
864 static function () use ( $services ) {
865 return $services->getContentLanguage();
866 }
867 );
868 },
869
870 'LanguageFactory' => static function ( MediaWikiServices $services ): LanguageFactory {
872 new ServiceOptions( LanguageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
873 $services->getNamespaceInfo(),
874 $services->getLocalisationCache(),
875 $services->getLanguageNameUtils(),
876 $services->getLanguageFallback(),
877 $services->getLanguageConverterFactory(),
878 $services->getHookContainer(),
879 $services->getMainConfig()
880 );
881 },
882
883 'LanguageFallback' => static function ( MediaWikiServices $services ): LanguageFallback {
885 $services->getMainConfig()->get( MainConfigNames::LanguageCode ),
886 $services->getLocalisationCache(),
887 $services->getLanguageNameUtils()
888 );
889 },
890
891 'LanguageNameUtils' => static function ( MediaWikiServices $services ): LanguageNameUtils {
893 new ServiceOptions(
894 LanguageNameUtils::CONSTRUCTOR_OPTIONS,
895 $services->getMainConfig()
896 ),
897 $services->getHookContainer()
898 );
899 },
900
901 'LinkBatchFactory' => static function ( MediaWikiServices $services ): LinkBatchFactory {
903 $services->getLinkCache(),
904 $services->getTitleFormatter(),
905 $services->getContentLanguage(),
906 $services->getGenderCache(),
907 $services->getDBLoadBalancer(),
908 $services->getLinksMigration(),
909 LoggerFactory::getInstance( 'LinkBatch' )
910 );
911 },
912
913 'LinkCache' => static function ( MediaWikiServices $services ): LinkCache {
914 // Database layer may be disabled, so processing without database connection
915 $dbLoadBalancer = $services->isServiceDisabled( 'DBLoadBalancer' )
916 ? null
917 : $services->getDBLoadBalancer();
918 $linkCache = new LinkCache(
919 $services->getTitleFormatter(),
920 $services->getMainWANObjectCache(),
921 $services->getNamespaceInfo(),
922 $dbLoadBalancer
923 );
924 $linkCache->setLogger( LoggerFactory::getInstance( 'LinkCache' ) );
925 return $linkCache;
926 },
927
928 'LinkRenderer' => static function ( MediaWikiServices $services ): LinkRenderer {
929 return $services->getLinkRendererFactory()->create();
930 },
931
932 'LinkRendererFactory' => static function ( MediaWikiServices $services ): LinkRendererFactory {
934 $services->getTitleFormatter(),
935 $services->getLinkCache(),
936 $services->getSpecialPageFactory(),
937 $services->getHookContainer()
938 );
939 },
940
941 'LinksMigration' => static function ( MediaWikiServices $services ): LinksMigration {
943 $services->getMainConfig(),
944 $services->getLinkTargetLookup()
945 );
946 },
947
948 'LinkTargetLookup' => static function ( MediaWikiServices $services ): LinkTargetLookup {
950 $services->getDBLoadBalancer(),
951 $services->getLocalServerObjectCache(),
952 $services->getMainWANObjectCache()
953 );
954 },
955
956 'LocalisationCache' => static function ( MediaWikiServices $services ): LocalisationCache {
957 $conf = $services->getMainConfig()->get( MainConfigNames::LocalisationCacheConf );
958
959 $logger = LoggerFactory::getInstance( 'localisation' );
960
962 $conf, $services->getMainConfig()->get( MainConfigNames::CacheDirectory ) );
963 $logger->debug( 'LocalisationCache using store ' . get_class( $store ) );
964
965 return new $conf['class'](
966 new ServiceOptions(
967 LocalisationCache::CONSTRUCTOR_OPTIONS,
968 // Two of the options are stored in $wgLocalisationCacheConf
969 $conf,
970 // In case someone set that config variable and didn't reset all keys, set defaults.
971 [
972 'forceRecache' => false,
973 'manualRecache' => false,
974 ],
975 // Some other options come from config itself
976 $services->getMainConfig()
977 ),
978 $store,
979 $logger,
980 [ static function () use ( $services ) {
981 // NOTE: Make sure we use the same cache object that is assigned in the
982 // constructor of the MessageBlobStore class used by ResourceLoader.
983 // T231866: Avoid circular dependency via ResourceLoader.
984 MessageBlobStore::clearGlobalCacheEntry( $services->getMainWANObjectCache() );
985 } ],
986 $services->getLanguageNameUtils(),
987 $services->getHookContainer()
988 );
989 },
990
991 'LocalServerObjectCache' => static function ( MediaWikiServices $services ): BagOStuff {
992 return ObjectCache::makeLocalServerCache();
993 },
994
995 'LockManagerGroupFactory' => static function ( MediaWikiServices $services ): LockManagerGroupFactory {
997 WikiMap::getCurrentWikiDbDomain()->getId(),
998 $services->getMainConfig()->get( MainConfigNames::LockManagers )
999 );
1000 },
1001
1002 'MagicWordFactory' => static function ( MediaWikiServices $services ): MagicWordFactory {
1004 $services->getContentLanguage(),
1005 $services->getHookContainer()
1006 );
1007 },
1008
1009 'MainConfig' => static function ( MediaWikiServices $services ): Config {
1010 // Use the 'main' config from the ConfigFactory service.
1011 return $services->getConfigFactory()->makeConfig( 'main' );
1012 },
1013
1014 'MainObjectStash' => static function ( MediaWikiServices $services ): BagOStuff {
1015 $mainConfig = $services->getMainConfig();
1016
1017 $id = $mainConfig->get( MainConfigNames::MainStash );
1018 $params = $mainConfig->get( MainConfigNames::ObjectCaches )[$id] ?? null;
1019 if ( !$params ) {
1020 throw new UnexpectedValueException(
1021 "\$wgObjectCaches must have \"$id\" set (via \$wgMainStash)"
1022 );
1023 }
1024
1025 $store = ObjectCache::newFromParams( $params, $services );
1026 $store->getLogger()->debug( 'MainObjectStash using store {class}', [
1027 'class' => get_class( $store )
1028 ] );
1029
1030 return $store;
1031 },
1032
1033 'MainWANObjectCache' => static function ( MediaWikiServices $services ): WANObjectCache {
1034 $mainConfig = $services->getMainConfig();
1035
1036 $store = $services->get( '_LocalClusterCache' );
1037 $logger = $store->getLogger();
1038 $logger->debug( 'MainWANObjectCache using store {class}', [
1039 'class' => get_class( $store )
1040 ] );
1041
1042 $wanParams = $mainConfig->get( MainConfigNames::WANObjectCache ) + [
1043 'cache' => $store,
1044 'logger' => $logger,
1045 'secret' => $mainConfig->get( MainConfigNames::SecretKey ),
1046 ];
1047 if ( !$GLOBALS[ 'wgCommandLineMode' ] ) {
1048 // Send the statsd data post-send on HTTP requests; avoid in CLI mode (T181385)
1049 $wanParams['stats'] = $services->getStatsdDataFactory();
1050 // Let pre-emptive refreshes happen post-send on HTTP requests
1051 $wanParams['asyncHandler'] = [ DeferredUpdates::class, 'addCallableUpdate' ];
1052 }
1053 return new WANObjectCache( $wanParams );
1054 },
1055
1056 'MediaHandlerFactory' => static function ( MediaWikiServices $services ): MediaHandlerFactory {
1058 LoggerFactory::getInstance( 'MediaHandlerFactory' ),
1059 $services->getMainConfig()->get( MainConfigNames::MediaHandlers )
1060 );
1061 },
1062
1063 'MergeHistoryFactory' => static function ( MediaWikiServices $services ): MergeHistoryFactory {
1064 return $services->getService( '_PageCommandFactory' );
1065 },
1066
1067 'MessageCache' => static function ( MediaWikiServices $services ): MessageCache {
1068 $mainConfig = $services->getMainConfig();
1069 $clusterCache = ObjectCache::getInstance( $mainConfig->get( MainConfigNames::MessageCacheType ) );
1070 $srvCache = $mainConfig->get( MainConfigNames::UseLocalMessageCache )
1071 ? $services->getLocalServerObjectCache()
1072 : new EmptyBagOStuff();
1073
1074 $logger = LoggerFactory::getInstance( 'MessageCache' );
1075 $logger->debug( 'MessageCache using store {class}', [
1076 'class' => get_class( $clusterCache )
1077 ] );
1078
1079 $options = new ServiceOptions( MessageCache::CONSTRUCTOR_OPTIONS, $mainConfig );
1080
1081 return new MessageCache(
1082 $services->getMainWANObjectCache(),
1083 $clusterCache,
1084 $srvCache,
1085 $services->getContentLanguage(),
1086 $services->getLanguageConverterFactory(),
1087 $logger,
1088 $options,
1089 $services->getLanguageFactory(),
1090 $services->getLocalisationCache(),
1091 $services->getLanguageNameUtils(),
1092 $services->getLanguageFallback(),
1093 $services->getHookContainer()
1094 );
1095 },
1096
1097 'MessageFormatterFactory' => static function ( MediaWikiServices $services ): IMessageFormatterFactory {
1099 },
1100
1101 'MimeAnalyzer' => static function ( MediaWikiServices $services ): MimeAnalyzer {
1102 $logger = LoggerFactory::getInstance( 'Mime' );
1103 $mainConfig = $services->getMainConfig();
1104 $hookRunner = new HookRunner( $services->getHookContainer() );
1105 $params = [
1106 'typeFile' => $mainConfig->get( MainConfigNames::MimeTypeFile ),
1107 'infoFile' => $mainConfig->get( MainConfigNames::MimeInfoFile ),
1108 'xmlTypes' => $mainConfig->get( MainConfigNames::XMLMimeTypes ),
1109 'guessCallback' =>
1110 static function ( $mimeAnalyzer, &$head, &$tail, $file, &$mime )
1111 use ( $logger, $hookRunner ) {
1112 // Also test DjVu
1113 $deja = new DjVuImage( $file );
1114 if ( $deja->isValid() ) {
1115 $logger->info( "Detected $file as image/vnd.djvu\n" );
1116 $mime = 'image/vnd.djvu';
1117
1118 return;
1119 }
1120 // Some strings by reference for performance - assuming well-behaved hooks
1121 $hookRunner->onMimeMagicGuessFromContent(
1122 $mimeAnalyzer, $head, $tail, $file, $mime );
1123 },
1124 'extCallback' => static function ( $mimeAnalyzer, $ext, &$mime ) use ( $hookRunner ) {
1125 // Media handling extensions can improve the MIME detected
1126 $hookRunner->onMimeMagicImproveFromExtension( $mimeAnalyzer, $ext, $mime );
1127 },
1128 'initCallback' => static function ( $mimeAnalyzer ) use ( $hookRunner ) {
1129 // Allow media handling extensions adding MIME-types and MIME-info
1130 $hookRunner->onMimeMagicInit( $mimeAnalyzer );
1131 },
1132 'logger' => $logger
1133 ];
1134
1135 if ( $params['infoFile'] === 'includes/mime.info' ) {
1136 $params['infoFile'] = MimeAnalyzer::USE_INTERNAL;
1137 }
1138
1139 if ( $params['typeFile'] === 'includes/mime.types' ) {
1140 $params['typeFile'] = MimeAnalyzer::USE_INTERNAL;
1141 }
1142
1143 $detectorCmd = $mainConfig->get( MainConfigNames::MimeDetectorCommand );
1144 if ( $detectorCmd ) {
1145 $factory = $services->getShellCommandFactory();
1146 $params['detectCallback'] = static function ( $file ) use ( $detectorCmd, $factory ) {
1147 $result = $factory->create()
1148 // $wgMimeDetectorCommand can contain commands with parameters
1149 ->unsafeParams( $detectorCmd )
1150 ->params( $file )
1151 ->execute();
1152 return $result->getStdout();
1153 };
1154 }
1155
1156 return new MimeAnalyzer( $params );
1157 },
1158
1159 'MovePageFactory' => static function ( MediaWikiServices $services ): MovePageFactory {
1160 return $services->getService( '_PageCommandFactory' );
1161 },
1162
1163 'NamespaceInfo' => static function ( MediaWikiServices $services ): NamespaceInfo {
1165 new ServiceOptions( NamespaceInfo::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1166 $services->getHookContainer()
1167 );
1168 },
1169
1170 'NameTableStoreFactory' => static function ( MediaWikiServices $services ): NameTableStoreFactory {
1172 $services->getDBLoadBalancerFactory(),
1173 $services->getMainWANObjectCache(),
1174 LoggerFactory::getInstance( 'NameTableSqlStore' )
1175 );
1176 },
1177
1178 'ObjectFactory' => static function ( MediaWikiServices $services ): ObjectFactory {
1179 return new ObjectFactory( $services );
1180 },
1181
1182 'OldRevisionImporter' => static function ( MediaWikiServices $services ): OldRevisionImporter {
1184 true,
1185 LoggerFactory::getInstance( 'OldRevisionImporter' ),
1186 $services->getDBLoadBalancer(),
1187 $services->getRevisionStore(),
1188 $services->getSlotRoleRegistry(),
1189 $services->getWikiPageFactory(),
1190 $services->getPageUpdaterFactory(),
1191 $services->getUserFactory()
1192 );
1193 },
1194
1195 'PageEditStash' => static function ( MediaWikiServices $services ): PageEditStash {
1197 ObjectCache::getLocalClusterInstance(),
1198 $services->getDBLoadBalancer(),
1199 LoggerFactory::getInstance( 'StashEdit' ),
1200 $services->getStatsdDataFactory(),
1201 $services->getUserEditTracker(),
1202 $services->getUserFactory(),
1203 $services->getWikiPageFactory(),
1204 $services->getHookContainer(),
1205 defined( 'MEDIAWIKI_JOB_RUNNER' ) || $GLOBALS[ 'wgCommandLineMode' ]
1206 ? PageEditStash::INITIATOR_JOB_OR_CLI
1207 : PageEditStash::INITIATOR_USER
1208 );
1209 },
1210
1211 'PageProps' => static function ( MediaWikiServices $services ): PageProps {
1212 return new PageProps(
1213 $services->getLinkBatchFactory(),
1214 $services->getDBLoadBalancer()
1215 );
1216 },
1217
1218 'PageRestHelperFactory' => static function ( MediaWikiServices $services ): PageRestHelperFactory {
1220 new ServiceOptions( PageRestHelperFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1221 $services->getRevisionLookup(),
1222 $services->getTitleFormatter(),
1223 $services->getPageStore(),
1224 $services->getParsoidOutputStash(),
1225 $services->getStatsdDataFactory(),
1226 $services->getParsoidOutputAccess(),
1227 $services->getHtmlTransformFactory(),
1228 $services->getContentHandlerFactory(),
1229 $services->getLanguageFactory()
1230 );
1231 },
1232
1233 'PageStore' => static function ( MediaWikiServices $services ): PageStore {
1234 return $services->getPageStoreFactory()->getPageStore();
1235 },
1236
1237 'PageStoreFactory' => static function ( MediaWikiServices $services ): PageStoreFactory {
1238 $options = new ServiceOptions(
1239 PageStoreFactory::CONSTRUCTOR_OPTIONS,
1240 $services->getMainConfig()
1241 );
1242
1243 return new PageStoreFactory(
1244 $options,
1245 $services->getDBLoadBalancerFactory(),
1246 $services->getNamespaceInfo(),
1247 $services->getTitleParser(),
1248 $services->getLinkCache(),
1249 $services->getStatsdDataFactory()
1250 );
1251 },
1252
1253 'PageUpdaterFactory' => static function (
1254 MediaWikiServices $services
1256 $editResultCache = new EditResultCache(
1257 $services->getMainObjectStash(),
1258 $services->getDBLoadBalancer(),
1259 new ServiceOptions(
1260 EditResultCache::CONSTRUCTOR_OPTIONS,
1261 $services->getMainConfig()
1262 )
1263 );
1264
1265 return new PageUpdaterFactory(
1266 $services->getRevisionStore(),
1267 $services->getRevisionRenderer(),
1268 $services->getSlotRoleRegistry(),
1269 $services->getParserCache(),
1270 $services->getParsoidOutputAccess(),
1271 $services->getJobQueueGroup(),
1272 $services->getMessageCache(),
1273 $services->getContentLanguage(),
1274 $services->getDBLoadBalancerFactory(),
1275 $services->getContentHandlerFactory(),
1276 $services->getHookContainer(),
1277 $editResultCache,
1278 $services->getUserNameUtils(),
1279 LoggerFactory::getInstance( 'SavePage' ),
1280 new ServiceOptions(
1281 PageUpdaterFactory::CONSTRUCTOR_OPTIONS,
1282 $services->getMainConfig()
1283 ),
1284 $services->getUserEditTracker(),
1285 $services->getUserGroupManager(),
1286 $services->getTitleFormatter(),
1287 $services->getContentTransformer(),
1288 $services->getPageEditStash(),
1289 $services->getTalkPageNotificationManager(),
1290 $services->getMainWANObjectCache(),
1291 $services->getPermissionManager(),
1292 $services->getWikiPageFactory(),
1294 );
1295 },
1296
1297 'Parser' => static function ( MediaWikiServices $services ): Parser {
1298 return $services->getParserFactory()->getMainInstance();
1299 },
1300
1301 'ParserCache' => static function ( MediaWikiServices $services ): ParserCache {
1302 return $services->getParserCacheFactory()
1303 ->getParserCache( ParserCacheFactory::DEFAULT_NAME );
1304 },
1305
1306 'ParserCacheFactory' => static function ( MediaWikiServices $services ): ParserCacheFactory {
1307 $config = $services->getMainConfig();
1308 $cache = ObjectCache::getInstance( $config->get( MainConfigNames::ParserCacheType ) );
1309 $wanCache = $services->getMainWANObjectCache();
1310
1311 $options = new ServiceOptions( ParserCacheFactory::CONSTRUCTOR_OPTIONS, $config );
1312
1313 return new ParserCacheFactory(
1314 $cache,
1315 $wanCache,
1316 $services->getHookContainer(),
1317 $services->getJsonCodec(),
1318 $services->getStatsdDataFactory(),
1319 LoggerFactory::getInstance( 'ParserCache' ),
1320 $options,
1321 $services->getTitleFactory(),
1322 $services->getWikiPageFactory()
1323 );
1324 },
1325
1326 'ParserFactory' => static function ( MediaWikiServices $services ): ParserFactory {
1327 $options = new ServiceOptions( Parser::CONSTRUCTOR_OPTIONS,
1328 $services->getMainConfig()
1329 );
1330
1331 return new ParserFactory(
1332 $options,
1333 $services->getMagicWordFactory(),
1334 $services->getContentLanguage(),
1335 $services->getUrlUtils(),
1336 $services->getSpecialPageFactory(),
1337 $services->getLinkRendererFactory(),
1338 $services->getNamespaceInfo(),
1339 LoggerFactory::getInstance( 'Parser' ),
1340 $services->getBadFileLookup(),
1341 $services->getLanguageConverterFactory(),
1342 $services->getHookContainer(),
1343 $services->getTidy(),
1344 $services->getMainWANObjectCache(),
1345 $services->getUserOptionsLookup(),
1346 $services->getUserFactory(),
1347 $services->getTitleFormatter(),
1348 $services->getHttpRequestFactory(),
1349 $services->getTrackingCategories(),
1350 $services->getSignatureValidatorFactory(),
1351 $services->getUserNameUtils()
1352 );
1353 },
1354
1355 'ParserOutputAccess' => static function ( MediaWikiServices $services ): ParserOutputAccess {
1357 $services->getParserCache(),
1358 $services->getParserCacheFactory()->getRevisionOutputCache( 'rcache' ),
1359 $services->getRevisionLookup(),
1360 $services->getRevisionRenderer(),
1361 $services->getStatsdDataFactory(),
1362 $services->getDBLoadBalancerFactory(),
1363 LoggerFactory::getProvider(),
1364 $services->getWikiPageFactory(),
1365 $services->getTitleFormatter()
1366 );
1367 },
1368
1369 'ParsoidDataAccess' => static function ( MediaWikiServices $services ): DataAccess {
1370 $mainConfig = $services->getMainConfig();
1371 $parsoidSettings = $mainConfig->get( MainConfigNames::ParsoidSettings );
1372 if ( !empty( $parsoidSettings['debugApi'] ) ) {
1373 return ApiDataAccess::fromSettings( $parsoidSettings );
1374 }
1375 return new MWDataAccess(
1377 $services->getRepoGroup(),
1378 $services->getBadFileLookup(),
1379 $services->getHookContainer(),
1380 $services->getContentTransformer(),
1381 $services->getReadOnlyMode(),
1382 $services->getParserFactory(), // *legacy* parser factory
1383 $services->getLinkBatchFactory()
1384 );
1385 },
1386
1387 'ParsoidOutputAccess' => static function ( MediaWikiServices $services ): ParsoidOutputAccess {
1389 new ServiceOptions(
1390 ParsoidOutputAccess::CONSTRUCTOR_OPTIONS,
1391 $services->getMainConfig(),
1392 [ 'ParsoidWikiID' => WikiMap::getCurrentWikiId() ]
1393 ),
1394 $services->getParserCacheFactory(),
1395 $services->getPageStore(),
1396 $services->getRevisionLookup(),
1397 $services->getGlobalIdGenerator(),
1398 $services->getStatsdDataFactory(),
1399 $services->getService( '_Parsoid' ),
1400 $services->getParsoidSiteConfig(),
1401 $services->getParsoidPageConfigFactory(),
1402 $services->getContentHandlerFactory()
1403 );
1404 },
1405
1406 'ParsoidOutputStash' => static function ( MediaWikiServices $services ): ParsoidOutputStash {
1407 // TODO: Determine storage requirements and config options for stashing parsoid
1408 // output for VE edits (T309016).
1409 $config = $services->getMainConfig()->get( MainConfigNames::ParsoidCacheConfig );
1410 $backend = $config['StashType']
1411 ? ObjectCache::getInstance( $config['StashType'] )
1412 : $services->getMainObjectStash();
1413
1414 return new SimpleParsoidOutputStash(
1415 $services->getContentHandlerFactory(),
1416 $backend,
1417 $config['StashDuration']
1418 );
1419 },
1420
1421 'ParsoidPageConfigFactory' => static function ( MediaWikiServices $services ): MWPageConfigFactory {
1422 return new MWPageConfigFactory(
1423 $services->getRevisionStore(),
1424 $services->getSlotRoleRegistry(),
1425 $services->getLanguageFactory()
1426 );
1427 },
1428
1429 'ParsoidSiteConfig' => static function ( MediaWikiServices $services ): SiteConfig {
1430 $mainConfig = $services->getMainConfig();
1431 $parsoidSettings = $mainConfig->get( MainConfigNames::ParsoidSettings );
1432 if ( !empty( $parsoidSettings['debugApi'] ) ) {
1433 return ApiSiteConfig::fromSettings( $parsoidSettings );
1434 }
1435 return new MWSiteConfig(
1437 $parsoidSettings,
1438 $services->getObjectFactory(),
1439 $services->getContentLanguage(),
1440 $services->getStatsdDataFactory(),
1441 $services->getMagicWordFactory(),
1442 $services->getNamespaceInfo(),
1443 $services->getSpecialPageFactory(),
1444 $services->getInterwikiLookup(),
1445 $services->getUserOptionsLookup(),
1446 $services->getLanguageFactory(),
1447 $services->getLanguageConverterFactory(),
1448 $services->getLanguageNameUtils(),
1449 $services->getUrlUtils(),
1450 // These arguments are temporary and will be removed once
1451 // better solutions are found.
1452 $services->getParser(), // T268776
1453 $mainConfig // T268777
1454 );
1455 },
1456
1457 'PasswordFactory' => static function ( MediaWikiServices $services ): PasswordFactory {
1458 $config = $services->getMainConfig();
1459 return new PasswordFactory(
1460 $config->get( MainConfigNames::PasswordConfig ),
1461 $config->get( MainConfigNames::PasswordDefault )
1462 );
1463 },
1464
1465 'PasswordReset' => static function ( MediaWikiServices $services ): PasswordReset {
1466 $options = new ServiceOptions( PasswordReset::CONSTRUCTOR_OPTIONS, $services->getMainConfig() );
1467 return new PasswordReset(
1468 $options,
1469 LoggerFactory::getInstance( 'authentication' ),
1470 $services->getAuthManager(),
1471 $services->getHookContainer(),
1472 $services->getDBLoadBalancer(),
1473 $services->getUserFactory(),
1474 $services->getUserNameUtils(),
1475 $services->getUserOptionsLookup()
1476 );
1477 },
1478
1479 'PerDbNameStatsdDataFactory' =>
1480 static function ( MediaWikiServices $services ): StatsdDataFactoryInterface {
1481 $config = $services->getMainConfig();
1482 $wiki = $config->get( MainConfigNames::DBname );
1484 $services->getStatsdDataFactory(),
1485 $wiki
1486 );
1487 },
1488
1489 'PermissionManager' => static function ( MediaWikiServices $services ): PermissionManager {
1491 new ServiceOptions(
1492 PermissionManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1493 ),
1494 $services->getSpecialPageFactory(),
1495 $services->getNamespaceInfo(),
1496 $services->getGroupPermissionsLookup(),
1497 $services->getUserGroupManager(),
1498 $services->getBlockErrorFormatter(),
1499 $services->getHookContainer(),
1500 $services->getUserCache(),
1501 $services->getRedirectLookup(),
1502 $services->getRestrictionStore(),
1503 $services->getTitleFormatter(),
1504 $services->getTempUserConfig(),
1505 $services->getUserFactory(),
1506 $services->getActionFactory()
1507 );
1508 },
1509
1510 'PoolCounterFactory' => static function ( MediaWikiServices $services ): PoolCounterFactory {
1511 $mainConfig = $services->getMainConfig();
1512 return new PoolCounterFactory(
1513 $mainConfig->get( MainConfigNames::PoolCounterConf ),
1514 $mainConfig->get( MainConfigNames::PoolCountClientConf )
1515 );
1516 },
1517
1518 'PreferencesFactory' => static function ( MediaWikiServices $services ): PreferencesFactory {
1519 $factory = new DefaultPreferencesFactory(
1520 new ServiceOptions(
1521 DefaultPreferencesFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1522 $services->getContentLanguage(),
1523 $services->getAuthManager(),
1524 $services->getLinkRendererFactory()->create(),
1525 $services->getNamespaceInfo(),
1526 $services->getPermissionManager(),
1527 $services->getLanguageConverterFactory()->getLanguageConverter(),
1528 $services->getLanguageNameUtils(),
1529 $services->getHookContainer(),
1530 $services->getUserOptionsManager(),
1531 $services->getLanguageConverterFactory(),
1532 $services->getParser(),
1533 $services->getSkinFactory(),
1534 $services->getUserGroupManager(),
1535 $services->getSignatureValidatorFactory(),
1536 $services->getMainConfig()
1537 );
1538 $factory->setLogger( LoggerFactory::getInstance( 'preferences' ) );
1539
1540 return $factory;
1541 },
1542
1543 'ProxyLookup' => static function ( MediaWikiServices $services ): ProxyLookup {
1544 $mainConfig = $services->getMainConfig();
1545 return new ProxyLookup(
1546 $mainConfig->get( MainConfigNames::CdnServers ),
1547 $mainConfig->get( MainConfigNames::CdnServersNoPurge ),
1548 $services->getHookContainer()
1549 );
1550 },
1551
1552 'RateLimiter' => static function ( MediaWikiServices $services ): RateLimiter {
1553 return new RateLimiter(
1554 new ServiceOptions( RateLimiter::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1555 $services->getWRStatsFactory(),
1556 $services->getCentralIdLookupFactory()->getNonLocalLookup(),
1557 $services->getUserFactory(),
1558 $services->getUserGroupManager(),
1559 $services->getHookContainer()
1560 );
1561 },
1562
1563 'ReadOnlyMode' => static function ( MediaWikiServices $services ): ReadOnlyMode {
1564 return new ReadOnlyMode(
1565 $services->getConfiguredReadOnlyMode(),
1566 $services->getDBLoadBalancer()
1567 );
1568 },
1569
1570 'RedirectLookup' => static function ( MediaWikiServices $services ): RedirectLookup {
1571 return $services->getRedirectStore();
1572 },
1573
1574 'RedirectStore' => static function ( MediaWikiServices $services ): RedirectStore {
1575 return new RedirectStore( $services->getWikiPageFactory() );
1576 },
1577
1578 'RepoGroup' => static function ( MediaWikiServices $services ): RepoGroup {
1579 $config = $services->getMainConfig();
1580 return new RepoGroup(
1581 $config->get( MainConfigNames::LocalFileRepo ),
1582 $config->get( MainConfigNames::ForeignFileRepos ),
1583 $services->getMainWANObjectCache(),
1584 $services->getMimeAnalyzer()
1585 );
1586 },
1587
1588 'ResourceLoader' => static function ( MediaWikiServices $services ): ResourceLoader {
1589 $config = $services->getMainConfig();
1590
1591 $maxage = $config->get( MainConfigNames::ResourceLoaderMaxage );
1592 $rl = new ResourceLoader(
1593 $config,
1594 LoggerFactory::getInstance( 'resourceloader' ),
1595 $config->get( MainConfigNames::ResourceLoaderUseObjectCacheForDeps )
1596 ? new KeyValueDependencyStore( $services->getMainObjectStash() )
1597 : new SqlModuleDependencyStore( $services->getDBLoadBalancer() ),
1598 [
1599 'loadScript' => $config->get( MainConfigNames::LoadScript ),
1600 'maxageVersioned' => $maxage['versioned'] ?? null,
1601 'maxageUnversioned' => $maxage['unversioned'] ?? null,
1602 'useFileCache' => $config->get( MainConfigNames::UseFileCache ),
1603 ]
1604 );
1605
1606 $extRegistry = ExtensionRegistry::getInstance();
1607 // Attribute has precedence over config
1608 $modules = $extRegistry->getAttribute( 'ResourceModules' )
1609 + $config->get( MainConfigNames::ResourceModules );
1610 $moduleSkinStyles = $extRegistry->getAttribute( 'ResourceModuleSkinStyles' )
1611 + $config->get( MainConfigNames::ResourceModuleSkinStyles );
1612
1613 $rl->setModuleSkinStyles( $moduleSkinStyles );
1614 $rl->addSource( $config->get( MainConfigNames::ResourceLoaderSources ) );
1615
1616 // Core modules, then extension/skin modules
1617 $baseDir = $config->get( MainConfigNames::BaseDirectory );
1618 $rl->register( include "$baseDir/resources/Resources.php" );
1619 $rl->register( $modules );
1620 $hookRunner = new \MediaWiki\ResourceLoader\HookRunner( $services->getHookContainer() );
1621 $hookRunner->onResourceLoaderRegisterModules( $rl );
1622
1623 $msgPosterAttrib = $extRegistry->getAttribute( 'MessagePosterModule' );
1624 $rl->register( 'mediawiki.messagePoster', [
1625 'localBasePath' => $baseDir,
1626 'debugRaw' => false,
1627 'scripts' => array_merge(
1628 [
1629 "resources/src/mediawiki.messagePoster/factory.js",
1630 "resources/src/mediawiki.messagePoster/MessagePoster.js",
1631 "resources/src/mediawiki.messagePoster/WikitextMessagePoster.js",
1632 ],
1633 $msgPosterAttrib['scripts'] ?? []
1634 ),
1635 'dependencies' => array_merge(
1636 [
1637 'oojs',
1638 'mediawiki.api',
1639 'mediawiki.ForeignApi',
1640 ],
1641 $msgPosterAttrib['dependencies'] ?? []
1642 ),
1643 'targets' => [ 'desktop', 'mobile' ],
1644 ] );
1645
1646 if ( $config->get( MainConfigNames::EnableJavaScriptTest ) === true ) {
1647 $rl->registerTestModules();
1648 }
1649
1650 return $rl;
1651 },
1652
1653 'RestrictionStore' => static function ( MediaWikiServices $services ): RestrictionStore {
1655 new ServiceOptions(
1656 RestrictionStore::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1657 ),
1658 $services->getMainWANObjectCache(),
1659 $services->getDBLoadBalancer(),
1660 $services->getLinkCache(),
1661 $services->getLinksMigration(),
1662 $services->getCommentStore(),
1663 $services->getHookContainer(),
1664 $services->getPageStore()
1665 );
1666 },
1667
1668 'RevertedTagUpdateManager' => static function ( MediaWikiServices $services ): RevertedTagUpdateManager {
1669 $editResultCache = new EditResultCache(
1670 $services->getMainObjectStash(),
1671 $services->getDBLoadBalancer(),
1672 new ServiceOptions(
1673 EditResultCache::CONSTRUCTOR_OPTIONS,
1674 $services->getMainConfig()
1675 )
1676 );
1677
1678 return new RevertedTagUpdateManager(
1679 $editResultCache,
1680 $services->getJobQueueGroup()
1681 );
1682 },
1683
1684 'RevisionFactory' => static function ( MediaWikiServices $services ): RevisionFactory {
1685 return $services->getRevisionStore();
1686 },
1687
1688 'RevisionLookup' => static function ( MediaWikiServices $services ): RevisionLookup {
1689 return $services->getRevisionStore();
1690 },
1691
1692 'RevisionRenderer' => static function ( MediaWikiServices $services ): RevisionRenderer {
1693 $renderer = new RevisionRenderer(
1694 $services->getDBLoadBalancer(),
1695 $services->getSlotRoleRegistry(),
1696 $services->getContentRenderer()
1697 );
1698
1699 $renderer->setLogger( LoggerFactory::getInstance( 'SaveParse' ) );
1700 return $renderer;
1701 },
1702
1703 'RevisionStore' => static function ( MediaWikiServices $services ): RevisionStore {
1704 return $services->getRevisionStoreFactory()->getRevisionStore();
1705 },
1706
1707 'RevisionStoreFactory' => static function ( MediaWikiServices $services ): RevisionStoreFactory {
1709 $services->getDBLoadBalancerFactory(),
1710 $services->getBlobStoreFactory(),
1711 $services->getNameTableStoreFactory(),
1712 $services->getSlotRoleRegistry(),
1713 $services->getMainWANObjectCache(),
1714 $services->getLocalServerObjectCache(),
1715 $services->getCommentStore(),
1716 $services->getActorMigration(),
1717 $services->getActorStoreFactory(),
1718 LoggerFactory::getInstance( 'RevisionStore' ),
1719 $services->getContentHandlerFactory(),
1720 $services->getPageStoreFactory(),
1721 $services->getTitleFactory(),
1722 $services->getHookContainer()
1723 );
1724 },
1725
1726 'RollbackPageFactory' => static function ( MediaWikiServices $services ): RollbackPageFactory {
1727 return $services->get( '_PageCommandFactory' );
1728 },
1729
1730 'RowCommentFormatter' => static function ( MediaWikiServices $services ): RowCommentFormatter {
1731 $parserFactory = new CommentParserFactory(
1732 $services->getLinkRenderer(),
1733 $services->getLinkBatchFactory(),
1734 $services->getLinkCache(),
1735 $services->getRepoGroup(),
1736 RequestContext::getMain()->getLanguage(),
1737 $services->getContentLanguage(),
1738 $services->getTitleParser(),
1739 $services->getNamespaceInfo(),
1740 $services->getHookContainer()
1741 );
1742 return new RowCommentFormatter(
1743 $parserFactory,
1744 $services->getCommentStore()
1745 );
1746 },
1747
1748 'SearchEngineConfig' => static function ( MediaWikiServices $services ): SearchEngineConfig {
1749 // @todo This should not take a Config object, but it's not so easy to remove because it
1750 // exposes it in a getter, which is actually used.
1752 $services->getMainConfig(),
1753 $services->getContentLanguage(),
1754 $services->getHookContainer(),
1755 ExtensionRegistry::getInstance()->getAttribute( 'SearchMappings' ),
1756 $services->getUserOptionsLookup()
1757 );
1758 },
1759
1760 'SearchEngineFactory' => static function ( MediaWikiServices $services ): SearchEngineFactory {
1762 $services->getSearchEngineConfig(),
1763 $services->getHookContainer(),
1764 $services->getDBLoadBalancer()
1765 );
1766 },
1767
1768 'SearchResultThumbnailProvider' => static function ( MediaWikiServices $services ): SearchResultThumbnailProvider {
1770 $services->getRepoGroup(),
1771 $services->getHookContainer()
1772 );
1773 },
1774
1775 'ShellboxClientFactory' => static function ( MediaWikiServices $services ): ShellboxClientFactory {
1776 $urls = $services->getMainConfig()->get( MainConfigNames::ShellboxUrls );
1777
1778 return new ShellboxClientFactory(
1779 $services->getHttpRequestFactory(),
1780 $urls,
1781 $services->getMainConfig()->get( MainConfigNames::ShellboxSecretKey )
1782 );
1783 },
1784
1785 'ShellCommandFactory' => static function ( MediaWikiServices $services ): CommandFactory {
1786 $config = $services->getMainConfig();
1787
1788 $limits = [
1789 'time' => $config->get( MainConfigNames::MaxShellTime ),
1790 'walltime' => $config->get( MainConfigNames::MaxShellWallClockTime ),
1791 'memory' => $config->get( MainConfigNames::MaxShellMemory ),
1792 'filesize' => $config->get( MainConfigNames::MaxShellFileSize ),
1793 ];
1794 $cgroup = $config->get( MainConfigNames::ShellCgroup );
1795 $restrictionMethod = $config->get( MainConfigNames::ShellRestrictionMethod );
1796
1797 $factory = new CommandFactory( $services->getShellboxClientFactory(),
1798 $limits, $cgroup, $restrictionMethod );
1799 $factory->setLogger( LoggerFactory::getInstance( 'exec' ) );
1800 $factory->logStderr();
1801
1802 return $factory;
1803 },
1804
1805 'SignatureValidatorFactory' => static function ( MediaWikiServices $services ): SignatureValidatorFactory {
1807 new ServiceOptions(
1808 SignatureValidator::CONSTRUCTOR_OPTIONS,
1809 $services->getMainConfig()
1810 ),
1811 // Use a closure for ParserFactory to avoid a circular dependency
1812 static function () use ( $services ) {
1813 return $services->getParserFactory();
1814 },
1815 $services->getSpecialPageFactory(),
1816 $services->getTitleFactory()
1817 );
1818 },
1819
1820 'SiteLookup' => static function ( MediaWikiServices $services ): SiteLookup {
1821 // Use SiteStore as the SiteLookup as well. This was originally separated
1822 // to allow for a cacheable read-only interface, but this was never used.
1823 // SiteStore has caching (see below).
1824 return $services->getSiteStore();
1825 },
1826
1827 'SiteStore' => static function ( MediaWikiServices $services ): SiteStore {
1828 $rawSiteStore = new DBSiteStore( $services->getDBLoadBalancer() );
1829
1830 $cache = $services->getLocalServerObjectCache();
1831 if ( $cache instanceof EmptyBagOStuff ) {
1833 }
1834
1835 return new CachingSiteStore( $rawSiteStore, $cache );
1836 },
1837
1839 'SkinFactory' => static function ( MediaWikiServices $services ): SkinFactory {
1840 $factory = new SkinFactory(
1841 $services->getObjectFactory(),
1842 (array)$services->getMainConfig()->get( MainConfigNames::SkipSkins )
1843 );
1844
1845 $names = $services->getMainConfig()->get( MainConfigNames::ValidSkinNames );
1846
1847 foreach ( $names as $name => $skin ) {
1848 if ( is_array( $skin ) ) {
1849 $spec = $skin;
1850 $displayName = $skin['displayname'] ?? $name;
1851 $skippable = $skin['skippable'] ?? null;
1852 } else {
1853 $displayName = $skin;
1854 $skippable = null;
1855 $spec = [
1856 'name' => $name,
1857 'class' => "Skin$skin"
1858 ];
1859 }
1860 $factory->register( $name, $displayName, $spec, $skippable );
1861 }
1862
1863 // Register a hidden "fallback" skin
1864 $factory->register( 'fallback', 'Fallback', [
1865 'class' => SkinFallback::class,
1866 'args' => [
1867 [
1868 'name' => 'fallback',
1869 'styles' => [ 'mediawiki.skinning.interface' ],
1870 'templateDirectory' => __DIR__ . '/skins/templates/fallback',
1871 ]
1872 ]
1873 ], true );
1874 // Register a hidden skin for api output
1875 $factory->register( 'apioutput', 'ApiOutput', [
1876 'class' => SkinApi::class,
1877 'args' => [
1878 [
1879 'name' => 'apioutput',
1880 'styles' => [ 'mediawiki.skinning.interface' ],
1881 'templateDirectory' => __DIR__ . '/skins/templates/apioutput',
1882 ]
1883 ]
1884 ], true );
1885
1886 return $factory;
1887 },
1888
1889 'SlotRoleRegistry' => static function ( MediaWikiServices $services ): SlotRoleRegistry {
1890 $registry = new SlotRoleRegistry(
1891 $services->getSlotRoleStore()
1892 );
1893
1894 $config = $services->getMainConfig();
1895 $contentHandlerFactory = $services->getContentHandlerFactory();
1896 $hookContainer = $services->getHookContainer();
1897 $titleFactory = $services->getTitleFactory();
1898 $registry->defineRole(
1899 SlotRecord::MAIN,
1900 static function () use ( $config, $contentHandlerFactory, $hookContainer, $titleFactory ) {
1901 return new MainSlotRoleHandler(
1902 $config->get( MainConfigNames::NamespaceContentModels ),
1903 $contentHandlerFactory,
1904 $hookContainer,
1905 $titleFactory
1906 );
1907 }
1908 );
1909
1910 return $registry;
1911 },
1912
1913 'SlotRoleStore' => static function ( MediaWikiServices $services ): NameTableStore {
1914 return $services->getNameTableStoreFactory()->getSlotRoles();
1915 },
1916
1917 'SpamChecker' => static function ( MediaWikiServices $services ): SpamChecker {
1918 return new SpamChecker(
1919 (array)$services->getMainConfig()->get( MainConfigNames::SpamRegex ),
1920 (array)$services->getMainConfig()->get( MainConfigNames::SummarySpamRegex )
1921 );
1922 },
1923
1924 'SpecialPageFactory' => static function ( MediaWikiServices $services ): SpecialPageFactory {
1926 new ServiceOptions(
1927 SpecialPageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1928 $services->getContentLanguage(),
1929 $services->getObjectFactory(),
1930 $services->getTitleFactory(),
1931 $services->getHookContainer()
1932 );
1933 },
1934
1935 'StatsCache' => static function ( MediaWikiServices $services ): StatsCache {
1936 return new StatsCache();
1937 },
1938
1939 'StatsdDataFactory' => static function ( MediaWikiServices $services ): IBufferingStatsdDataFactory {
1941 rtrim( $services->getMainConfig()->get( MainConfigNames::StatsdMetricPrefix ), '.' )
1942 );
1943 },
1944
1945 'StatsFactory' => static function ( MediaWikiServices $services ): StatsFactory {
1946 $config = $services->getMainConfig();
1947 $format = \Wikimedia\Stats\OutputFormats::getFormatFromString(
1948 $config->get( MainConfigNames::StatsFormat ) ?? 'null'
1949 );
1950 $cache = $services->getService( 'StatsCache' );
1951 $emitter = \Wikimedia\Stats\OutputFormats::getNewEmitter(
1952 $config->get( MainConfigNames::StatsPrefix ) ?? 'MediaWiki',
1953 $cache,
1954 \Wikimedia\Stats\OutputFormats::getNewFormatter( $format ),
1955 $config->get( MainConfigNames::StatsTarget )
1956 );
1957 $factory = new StatsFactory( 'core', $cache, $emitter, LoggerFactory::getInstance( 'Stats' ) );
1958 return $factory->withStatsdDataFactory( $services->getStatsdDataFactory() );
1959 },
1960
1961 'TalkPageNotificationManager' => static function (
1962 MediaWikiServices $services
1965 new ServiceOptions(
1966 TalkPageNotificationManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1967 ),
1968 $services->getDBLoadBalancer(),
1969 $services->getReadOnlyMode(),
1970 $services->getRevisionLookup(),
1971 $services->getHookContainer(),
1972 $services->getUserFactory()
1973 );
1974 },
1975
1976 'TempFSFileFactory' => static function ( MediaWikiServices $services ): TempFSFileFactory {
1977 return new TempFSFileFactory( $services->getMainConfig()->get( MainConfigNames::TmpDirectory ) );
1978 },
1979
1980 'TempUserConfig' => static function ( MediaWikiServices $services ): RealTempUserConfig {
1982 $services->getMainConfig()->get( MainConfigNames::AutoCreateTempUser )
1983 );
1984 },
1985
1986 'TempUserCreator' => static function ( MediaWikiServices $services ): TempUserCreator {
1987 $accountCreationThrottle = $services->getMainConfig()->get( MainConfigNames::AccountCreationThrottle );
1988 // T306878: Handle old $wgAccountCreationThrottle format (number of attempts per 24 hours)
1989 if ( !is_array( $accountCreationThrottle ) ) {
1990 $accountCreationThrottle = [ [
1991 'count' => $accountCreationThrottle,
1992 'seconds' => 86400,
1993 ] ];
1994 }
1995
1996 return new TempUserCreator(
1997 $services->getTempUserConfig(),
1998 $services->getObjectFactory(),
1999 $services->getUserFactory(),
2000 $services->getAuthManager(),
2001 // This is supposed to match ThrottlePreAuthenticationProvider
2002 new Throttler(
2003 $accountCreationThrottle,
2004 [
2005 'type' => 'acctcreate',
2006 'cache' => $services->getLocalServerObjectCache()
2007 ]
2008 )
2009 );
2010 },
2011
2012 'Tidy' => static function ( MediaWikiServices $services ): TidyDriverBase {
2013 return new RemexDriver(
2014 new ServiceOptions(
2015 RemexDriver::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
2016 )
2017 );
2018 },
2019
2020 'TitleFactory' => static function ( MediaWikiServices $services ): TitleFactory {
2021 return new TitleFactory();
2022 },
2023
2024 'TitleFormatter' => static function ( MediaWikiServices $services ): TitleFormatter {
2025 return $services->getService( '_MediaWikiTitleCodec' );
2026 },
2027
2028 'TitleMatcher' => static function ( MediaWikiServices $services ): TitleMatcher {
2029 return new TitleMatcher(
2030 new ServiceOptions(
2031 TitleMatcher::CONSTRUCTOR_OPTIONS,
2032 $services->getMainConfig()
2033 ),
2034 $services->getContentLanguage(),
2035 $services->getLanguageConverterFactory(),
2036 $services->getHookContainer(),
2037 $services->getWikiPageFactory(),
2038 $services->getUserNameUtils(),
2039 $services->getRepoGroup()
2040 );
2041 },
2042
2043 'TitleParser' => static function ( MediaWikiServices $services ): TitleParser {
2044 return $services->getService( '_MediaWikiTitleCodec' );
2045 },
2046
2047 'TrackingCategories' => static function ( MediaWikiServices $services ): TrackingCategories {
2049 new ServiceOptions(
2050 TrackingCategories::CONSTRUCTOR_OPTIONS,
2051 $services->getMainConfig()
2052 ),
2053 $services->getNamespaceInfo(),
2054 $services->getTitleParser(),
2055 LoggerFactory::getInstance( 'TrackingCategories' )
2056 );
2057 },
2058
2059 'UnblockUserFactory' => static function ( MediaWikiServices $services ): UnblockUserFactory {
2060 return $services->getService( '_UserBlockCommandFactory' );
2061 },
2062
2063 'UndeletePageFactory' => static function ( MediaWikiServices $services ): UndeletePageFactory {
2064 return $services->getService( '_PageCommandFactory' );
2065 },
2066
2067 'UploadRevisionImporter' => static function ( MediaWikiServices $services ): UploadRevisionImporter {
2069 $services->getMainConfig()->get( MainConfigNames::EnableUploads ),
2070 LoggerFactory::getInstance( 'UploadRevisionImporter' )
2071 );
2072 },
2073
2074 'UrlUtils' => static function ( MediaWikiServices $services ): UrlUtils {
2075 $config = $services->getMainConfig();
2076 return new UrlUtils( [
2077 UrlUtils::SERVER => $config->get( MainConfigNames::Server ),
2078 UrlUtils::CANONICAL_SERVER => $config->get( MainConfigNames::CanonicalServer ),
2079 UrlUtils::INTERNAL_SERVER => $config->get( MainConfigNames::InternalServer ),
2080 UrlUtils::FALLBACK_PROTOCOL => RequestContext::getMain()->getRequest()->getProtocol(),
2081 UrlUtils::HTTPS_PORT => $config->get( MainConfigNames::HttpsPort ),
2082 UrlUtils::VALID_PROTOCOLS => $config->get( MainConfigNames::UrlProtocols ),
2083 ] );
2084 },
2085
2086 'UserCache' => static function ( MediaWikiServices $services ): UserCache {
2087 return new UserCache(
2088 LoggerFactory::getInstance( 'UserCache' ),
2089 $services->getDBLoadBalancer(),
2090 $services->getLinkBatchFactory()
2091 );
2092 },
2093
2094 'UserEditTracker' => static function ( MediaWikiServices $services ): UserEditTracker {
2096 $services->getActorMigration(),
2097 $services->getDBLoadBalancer(),
2098 $services->getJobQueueGroup()
2099 );
2100 },
2101
2102 'UserFactory' => static function ( MediaWikiServices $services ): UserFactory {
2103 return new UserFactory(
2104 $services->getDBLoadBalancer(),
2105 $services->getUserNameUtils()
2106 );
2107 },
2108
2109 'UserGroupManager' => static function ( MediaWikiServices $services ): UserGroupManager {
2110 return $services->getUserGroupManagerFactory()->getUserGroupManager();
2111 },
2112
2113 'UserGroupManagerFactory' => static function ( MediaWikiServices $services ): UserGroupManagerFactory {
2115 new ServiceOptions(
2116 UserGroupManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
2117 ),
2118 $services->getConfiguredReadOnlyMode(),
2119 $services->getDBLoadBalancerFactory(),
2120 $services->getHookContainer(),
2121 $services->getUserEditTracker(),
2122 $services->getGroupPermissionsLookup(),
2123 $services->getJobQueueGroupFactory(),
2124 LoggerFactory::getInstance( 'UserGroupManager' ),
2125 $services->getTempUserConfig(),
2126 [ static function ( UserIdentity $user ) use ( $services ) {
2127 $services->getPermissionManager()->invalidateUsersRightsCache( $user );
2128 $services->getUserFactory()->newFromUserIdentity( $user )->invalidateCache();
2129 } ]
2130 );
2131 },
2132
2133 'UserIdentityLookup' => static function ( MediaWikiServices $services ): UserIdentityLookup {
2134 return $services->getActorStoreFactory()->getUserIdentityLookup();
2135 },
2136
2137 'UserNamePrefixSearch' => static function ( MediaWikiServices $services ): UserNamePrefixSearch {
2139 $services->getDBLoadBalancer(),
2140 $services->getUserNameUtils()
2141 );
2142 },
2143
2144 'UserNameUtils' => static function ( MediaWikiServices $services ): UserNameUtils {
2145 $messageFormatterFactory = new MessageFormatterFactory( Message::FORMAT_PLAIN );
2146 return new UserNameUtils(
2147 new ServiceOptions(
2148 UserNameUtils::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
2149 ),
2150 $services->getContentLanguage(),
2151 LoggerFactory::getInstance( 'UserNameUtils' ),
2152 $services->getTitleParser(),
2153 $messageFormatterFactory->getTextFormatter(
2154 $services->getContentLanguage()->getCode()
2155 ),
2156 $services->getHookContainer(),
2157 $services->getTempUserConfig()
2158 );
2159 },
2160
2161 'UserOptionsLookup' => static function ( MediaWikiServices $services ): UserOptionsLookup {
2162 return $services->getUserOptionsManager();
2163 },
2164
2165 'UserOptionsManager' => static function ( MediaWikiServices $services ): UserOptionsManager {
2167 new ServiceOptions( UserOptionsManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
2168 $services->get( '_DefaultOptionsLookup' ),
2169 $services->getLanguageConverterFactory(),
2170 $services->getDBLoadBalancer(),
2171 LoggerFactory::getInstance( 'UserOptionsManager' ),
2172 $services->getHookContainer(),
2173 $services->getUserFactory()
2174 );
2175 },
2176
2177 'VirtualRESTServiceClient' =>
2178 static function ( MediaWikiServices $services ): VirtualRESTServiceClient {
2179 $config = $services->getMainConfig()->get( MainConfigNames::VirtualRestConfig );
2180
2181 $vrsClient = new VirtualRESTServiceClient(
2182 $services->getHttpRequestFactory()->createMultiClient() );
2183 foreach ( $config['paths'] as $prefix => $serviceConfig ) {
2184 $class = $serviceConfig['class'];
2185 // Merge in the global defaults
2186 $constructArg = $serviceConfig['options'] ?? [];
2187 $constructArg += $config['global'];
2188 // Make the VRS service available at the mount point
2189 $vrsClient->mount( $prefix, [ 'class' => $class, 'config' => $constructArg ] );
2190 }
2191
2192 return $vrsClient;
2193 },
2194
2195 'WatchedItemQueryService' =>
2196 static function ( MediaWikiServices $services ): WatchedItemQueryService {
2198 $services->getDBLoadBalancer(),
2199 $services->getCommentStore(),
2200 $services->getWatchedItemStore(),
2201 $services->getHookContainer(),
2202 $services->getUserOptionsLookup(),
2203 $services->getMainConfig()->get( MainConfigNames::WatchlistExpiry ),
2204 $services->getMainConfig()->get( MainConfigNames::MaxExecutionTimeForExpensiveQueries )
2205 );
2206 },
2207
2208 'WatchedItemStore' => static function ( MediaWikiServices $services ): WatchedItemStore {
2209 $store = new WatchedItemStore(
2210 new ServiceOptions( WatchedItemStore::CONSTRUCTOR_OPTIONS,
2211 $services->getMainConfig() ),
2212 $services->getDBLoadBalancerFactory(),
2213 $services->getJobQueueGroup(),
2214 $services->getMainObjectStash(),
2215 new HashBagOStuff( [ 'maxKeys' => 100 ] ),
2216 $services->getReadOnlyMode(),
2217 $services->getNamespaceInfo(),
2218 $services->getRevisionLookup(),
2219 $services->getLinkBatchFactory()
2220 );
2221 $store->setStatsdDataFactory( $services->getStatsdDataFactory() );
2222
2223 if ( $services->getMainConfig()->get( MainConfigNames::ReadOnlyWatchedItemStore ) ) {
2224 $store = new NoWriteWatchedItemStore( $store );
2225 }
2226
2227 return $store;
2228 },
2229
2230 'WatchlistManager' => static function ( MediaWikiServices $services ): WatchlistManager {
2232 [
2233 WatchlistManager::OPTION_ENOTIF =>
2234 RecentChange::isEnotifEnabled( $services->getMainConfig() ),
2235 ],
2236 $services->getHookContainer(),
2237 $services->getReadOnlyMode(),
2238 $services->getRevisionLookup(),
2239 $services->getTalkPageNotificationManager(),
2240 $services->getWatchedItemStore(),
2241 $services->getUserFactory(),
2242 $services->getNamespaceInfo(),
2243 $services->getWikiPageFactory()
2244 );
2245 },
2246
2247 'WikiExporterFactory' => static function ( MediaWikiServices $services ): WikiExporterFactory {
2249 $services->getHookContainer(),
2250 $services->getRevisionStore(),
2251 $services->getTitleParser(),
2252 $services->getCommentStore()
2253 );
2254 },
2255
2256 'WikiImporterFactory' => static function ( MediaWikiServices $services ): WikiImporterFactory {
2258 $services->getMainConfig(),
2259 $services->getHookContainer(),
2260 $services->getContentLanguage(),
2261 $services->getNamespaceInfo(),
2262 $services->getTitleFactory(),
2263 $services->getWikiPageFactory(),
2264 $services->getWikiRevisionUploadImporter(),
2265 $services->getPermissionManager(),
2266 $services->getContentHandlerFactory(),
2267 $services->getSlotRoleRegistry()
2268 );
2269 },
2270
2271 'WikiPageFactory' => static function ( MediaWikiServices $services ): WikiPageFactory {
2273 $services->getTitleFactory(),
2274 new HookRunner( $services->getHookContainer() ),
2275 $services->getDBLoadBalancer()
2276 );
2277 },
2278
2279 'WikiRevisionOldRevisionImporterNoUpdates' =>
2280 static function ( MediaWikiServices $services ): ImportableOldRevisionImporter {
2282 false,
2283 LoggerFactory::getInstance( 'OldRevisionImporter' ),
2284 $services->getDBLoadBalancer(),
2285 $services->getRevisionStore(),
2286 $services->getSlotRoleRegistry(),
2287 $services->getWikiPageFactory(),
2288 $services->getPageUpdaterFactory(),
2289 $services->getUserFactory()
2290 );
2291 },
2292
2293 'WRStatsFactory' => static function ( MediaWikiServices $services ): WRStatsFactory {
2296 ObjectCache::getInstance( $services->getMainConfig()->get( MainConfigNames::StatsCacheType ) )
2297 )
2298 );
2299 },
2300
2301 '_DefaultOptionsLookup' => static function ( MediaWikiServices $services ): DefaultOptionsLookup {
2303 new ServiceOptions( DefaultOptionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
2304 $services->getContentLanguage(),
2305 $services->getHookContainer(),
2306 $services->getNamespaceInfo()
2307 );
2308 },
2309
2310 '_EditConstraintFactory' => static function ( MediaWikiServices $services ): EditConstraintFactory {
2311 // This service is internal and currently only exists because a significant number
2312 // of dependencies will be needed by different constraints. It is not part of
2313 // the public interface and has no corresponding method in MediaWikiServices
2315 // Multiple
2316 new ServiceOptions(
2317 EditConstraintFactory::CONSTRUCTOR_OPTIONS,
2318 $services->getMainConfig()
2319 ),
2320 LoggerFactory::getProvider(),
2321
2322 // UserBlockConstraint
2323 $services->getPermissionManager(),
2324
2325 // EditFilterMergedContentHookConstraint
2326 $services->getHookContainer(),
2327
2328 // ReadOnlyConstraint
2329 $services->getReadOnlyMode(),
2330
2331 // SpamRegexConstraint
2332 $services->getSpamChecker()
2333 );
2334 },
2335
2336 '_LocalClusterCache' => static function ( MediaWikiServices $services ): BagOStuff {
2337 $mainConfig = $services->getMainConfig();
2338 $id = $mainConfig->get( MainConfigNames::MainCacheType );
2339 $params = $mainConfig->get( MainConfigNames::ObjectCaches )[$id] ?? null;
2340 if ( !$params ) {
2341 throw new UnexpectedValueException(
2342 "\$wgObjectCaches must have \"$id\" set (via \$wgMainCacheType)"
2343 );
2344 }
2345 return ObjectCache::newFromParams( $params, $services );
2346 },
2347
2348 '_MediaWikiTitleCodec' => static function ( MediaWikiServices $services ): MediaWikiTitleCodec {
2350 $services->getContentLanguage(),
2351 $services->getGenderCache(),
2352 $services->getMainConfig()->get( MainConfigNames::LocalInterwikis ),
2353 $services->getInterwikiLookup(),
2354 $services->getNamespaceInfo()
2355 );
2356 },
2357
2358 '_PageCommandFactory' => static function ( MediaWikiServices $services ): PageCommandFactory {
2360 $services->getMainConfig(),
2361 $services->getDBLoadBalancerFactory(),
2362 $services->getNamespaceInfo(),
2363 $services->getWatchedItemStore(),
2364 $services->getRepoGroup(),
2365 $services->getReadOnlyMode(),
2366 $services->getContentHandlerFactory(),
2367 $services->getRevisionStore(),
2368 $services->getSpamChecker(),
2369 $services->getTitleFormatter(),
2370 $services->getHookContainer(),
2371 $services->getWikiPageFactory(),
2372 $services->getUserFactory(),
2373 $services->getActorMigration(),
2374 $services->getActorNormalization(),
2375 $services->getTitleFactory(),
2376 $services->getUserEditTracker(),
2377 $services->getCollationFactory(),
2378 $services->getJobQueueGroup(),
2379 $services->getCommentStore(),
2380 $services->getMainObjectStash(),
2381 WikiMap::getCurrentWikiDbDomain()->getId(),
2382 WebRequest::getRequestId(),
2383 $services->getBacklinkCacheFactory(),
2384 LoggerFactory::getInstance( 'UndeletePage' ),
2385 $services->getPageUpdaterFactory(),
2386 $services->getMessageFormatterFactory()->getTextFormatter(
2387 $services->getContentLanguage()->getCode()
2388 ),
2389 $services->getArchivedRevisionLookup(),
2390 $services->getRestrictionStore()
2391 );
2392 },
2393
2394 '_ParserObserver' => static function ( MediaWikiServices $services ): ParserObserver {
2395 return new ParserObserver( LoggerFactory::getInstance( 'DuplicateParse' ) );
2396 },
2397
2398 '_Parsoid' => static function ( MediaWikiServices $services ): Parsoid {
2399 return new Parsoid(
2400 $services->getParsoidSiteConfig(),
2401 $services->getParsoidDataAccess()
2402 );
2403 },
2404
2405 '_SettingsBuilder' => static function ( MediaWikiServices $services ): SettingsBuilder {
2406 return SettingsBuilder::getInstance();
2407 },
2408
2409 '_SqlBlobStore' => static function ( MediaWikiServices $services ): SqlBlobStore {
2410 return $services->getBlobStoreFactory()->newSqlBlobStore();
2411 },
2412
2413 '_UserBlockCommandFactory' => static function ( MediaWikiServices $services ): UserBlockCommandFactory {
2415 new ServiceOptions( UserBlockCommandFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
2416 $services->getHookContainer(),
2417 $services->getBlockPermissionCheckerFactory(),
2418 $services->getBlockUtils(),
2419 $services->getDatabaseBlockStore(),
2420 $services->getBlockRestrictionStore(),
2421 $services->getUserFactory(),
2422 $services->getUserEditTracker(),
2423 LoggerFactory::getInstance( 'BlockManager' ),
2424 $services->getTitleFactory(),
2425 $services->getBlockActionInfo()
2426 );
2427 },
2428
2430 // NOTE: When adding a service here, don't forget to add a getter function
2431 // in the MediaWikiServices class. The convenience getter should just call
2432 // $this->getService( 'FooBarService' ).
2434
2435];
const MIGRATION_NEW
Definition Defines.php:306
const SCHEMA_COMPAT_NEW
Definition Defines.php:279
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
wfShellExec( $cmd, &$retval=null, $environ=[], $limits=[], $options=[])
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported...
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
return[ 'ActionFactory'=> static function(MediaWikiServices $services):ActionFactory { return new ActionFactory($services->getMainConfig() ->get(MainConfigNames::Actions), LoggerFactory::getInstance( 'ActionFactory'), $services->getObjectFactory(), $services->getHookContainer());}, 'ActorMigration'=> static function(MediaWikiServices $services):ActorMigration { return new ActorMigration(SCHEMA_COMPAT_NEW, $services->getActorStoreFactory());}, 'ActorNormalization'=> static function(MediaWikiServices $services):ActorNormalization { return $services->getActorStoreFactory() ->getActorNormalization();}, 'ActorStore'=> static function(MediaWikiServices $services):ActorStore { return $services->getActorStoreFactory() ->getActorStore();}, 'ActorStoreFactory'=> static function(MediaWikiServices $services):ActorStoreFactory { return new ActorStoreFactory(new ServiceOptions(ActorStoreFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getDBLoadBalancerFactory(), $services->getUserNameUtils(), LoggerFactory::getInstance( 'ActorStore'));}, 'ArchivedRevisionLookup'=> static function(MediaWikiServices $services):ArchivedRevisionLookup { return new ArchivedRevisionLookup($services->getDBLoadBalancer(), $services->getRevisionStore());}, 'AuthManager'=> static function(MediaWikiServices $services):AuthManager { $authManager=new AuthManager(RequestContext::getMain() ->getRequest(), $services->getMainConfig(), $services->getObjectFactory(), $services->getHookContainer(), $services->getReadOnlyMode(), $services->getUserNameUtils(), $services->getBlockManager(), $services->getWatchlistManager(), $services->getDBLoadBalancer(), $services->getContentLanguage(), $services->getLanguageConverterFactory(), $services->getBotPasswordStore(), $services->getUserFactory(), $services->getUserIdentityLookup(), $services->getUserOptionsManager());$authManager->setLogger(LoggerFactory::getInstance( 'authentication'));return $authManager;}, 'BacklinkCacheFactory'=> static function(MediaWikiServices $services):BacklinkCacheFactory { return new BacklinkCacheFactory($services->getMainWANObjectCache(), $services->getHookContainer());}, 'BadFileLookup'=> static function(MediaWikiServices $services):BadFileLookup { return new BadFileLookup(static function() { return wfMessage( 'bad_image_list') ->inContentLanguage() ->plain();}, $services->getLocalServerObjectCache(), $services->getRepoGroup(), $services->getTitleParser(), $services->getHookContainer());}, 'BlobStore'=> static function(MediaWikiServices $services):BlobStore { return $services->getService( '_SqlBlobStore');}, 'BlobStoreFactory'=> static function(MediaWikiServices $services):BlobStoreFactory { return new BlobStoreFactory($services->getDBLoadBalancerFactory(), $services->getExternalStoreAccess(), $services->getMainWANObjectCache(), new ServiceOptions(BlobStoreFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'BlockActionInfo'=> static function(MediaWikiServices $services):BlockActionInfo { return new BlockActionInfo( $services->getHookContainer());}, 'BlockErrorFormatter'=> static function(MediaWikiServices $services):BlockErrorFormatter { return new BlockErrorFormatter($services->getTitleFormatter(), $services->getHookContainer(), $services->getUserNameUtils());}, 'BlockManager'=> static function(MediaWikiServices $services):BlockManager { return new BlockManager(new ServiceOptions(BlockManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getPermissionManager(), $services->getUserFactory(), LoggerFactory::getInstance( 'BlockManager'), $services->getHookContainer());}, 'BlockPermissionCheckerFactory'=> static function(MediaWikiServices $services):BlockPermissionCheckerFactory { return new BlockPermissionCheckerFactory(new ServiceOptions(BlockPermissionCheckerFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getBlockUtils());}, 'BlockRestrictionStore'=> static function(MediaWikiServices $services):BlockRestrictionStore { return $services->getBlockRestrictionStoreFactory() ->getBlockRestrictionStore(WikiAwareEntity::LOCAL);}, 'BlockRestrictionStoreFactory'=> static function(MediaWikiServices $services):BlockRestrictionStoreFactory { return new BlockRestrictionStoreFactory($services->getDBLoadBalancerFactory());}, 'BlockUserFactory'=> static function(MediaWikiServices $services):BlockUserFactory { return $services->getService( '_UserBlockCommandFactory');}, 'BlockUtils'=> static function(MediaWikiServices $services):BlockUtils { return new BlockUtils(new ServiceOptions(BlockUtils::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getUserIdentityLookup(), $services->getUserNameUtils());}, 'BotPasswordStore'=> static function(MediaWikiServices $services):BotPasswordStore { return new BotPasswordStore(new ServiceOptions(BotPasswordStore::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getCentralIdLookup(), $services->getDBLoadBalancerFactory());}, 'CentralIdLookup'=> static function(MediaWikiServices $services):CentralIdLookup { return $services->getCentralIdLookupFactory() ->getLookup();}, 'CentralIdLookupFactory'=> static function(MediaWikiServices $services):CentralIdLookupFactory { return new CentralIdLookupFactory(new ServiceOptions(CentralIdLookupFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getObjectFactory(), $services->getUserIdentityLookup());}, 'ChangeTagDefStore'=> static function(MediaWikiServices $services):NameTableStore { return $services->getNameTableStoreFactory() ->getChangeTagDef();}, 'CollationFactory'=> static function(MediaWikiServices $services):CollationFactory { return new CollationFactory(new ServiceOptions(CollationFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getObjectFactory(), $services->getHookContainer());}, 'CommentFormatter'=> static function(MediaWikiServices $services):CommentFormatter { $linkRenderer=$services->getLinkRendererFactory() ->create([ 'renderForComment'=> true]);$parserFactory=new CommentParserFactory($linkRenderer, $services->getLinkBatchFactory(), $services->getLinkCache(), $services->getRepoGroup(), RequestContext::getMain() ->getLanguage(), $services->getContentLanguage(), $services->getTitleParser(), $services->getNamespaceInfo(), $services->getHookContainer());return new CommentFormatter( $parserFactory);}, 'CommentStore'=> static function(MediaWikiServices $services):CommentStore { return new CommentStore($services->getContentLanguage(), MIGRATION_NEW, $services->getMainConfig() ->get(MainConfigNames::CommentTempTableSchemaMigrationStage));}, 'ConfigFactory'=> static function(MediaWikiServices $services):ConfigFactory { $registry=$services->getBootstrapConfig() ->get(MainConfigNames::ConfigRegistry);$factory=new ConfigFactory();foreach( $registry as $name=> $callback) { $factory->register( $name, $callback);} return $factory;}, 'ConfigRepository'=> static function(MediaWikiServices $services):ConfigRepository { return new ConfigRepository( $services->getConfigFactory());}, 'ConfigSchema'=> static function(MediaWikiServices $services):ConfigSchema { $settings=$services->get( '_SettingsBuilder');return $settings->getConfigSchema();}, 'ConfiguredReadOnlyMode'=> static function(MediaWikiServices $services):ConfiguredReadOnlyMode { $config=$services->getMainConfig();return new ConfiguredReadOnlyMode($config->get(MainConfigNames::ReadOnly), $config->get(MainConfigNames::ReadOnlyFile));}, 'ContentHandlerFactory'=> static function(MediaWikiServices $services):IContentHandlerFactory { $contentHandlerConfig=$services->getMainConfig() ->get(MainConfigNames::ContentHandlers);return new ContentHandlerFactory($contentHandlerConfig, $services->getObjectFactory(), $services->getHookContainer(), LoggerFactory::getInstance( 'ContentHandler'));}, 'ContentLanguage'=> static function(MediaWikiServices $services):Language { return $services->getLanguageFactory() ->getLanguage($services->getMainConfig() ->get(MainConfigNames::LanguageCode));}, 'ContentModelChangeFactory'=> static function(MediaWikiServices $services):ContentModelChangeFactory { return $services->getService( '_PageCommandFactory');}, 'ContentModelStore'=> static function(MediaWikiServices $services):NameTableStore { return $services->getNameTableStoreFactory() ->getContentModels();}, 'ContentRenderer'=> static function(MediaWikiServices $services):ContentRenderer { return new ContentRenderer( $services->getContentHandlerFactory());}, 'ContentTransformer'=> static function(MediaWikiServices $services):ContentTransformer { return new ContentTransformer( $services->getContentHandlerFactory());}, 'ContributionsLookup'=> static function(MediaWikiServices $services):ContributionsLookup { return new ContributionsLookup($services->getRevisionStore(), $services->getLinkRendererFactory(), $services->getLinkBatchFactory(), $services->getHookContainer(), $services->getDBLoadBalancer(), $services->getActorMigration(), $services->getNamespaceInfo(), $services->getCommentFormatter());}, 'CriticalSectionProvider'=> static function(MediaWikiServices $services):CriticalSectionProvider { $config=$services->getMainConfig();$limit=$GLOBALS[ 'wgCommandLineMode'] ? INF :$config->get(MainConfigNames::CriticalSectionTimeLimit);return RequestTimeout::singleton() ->createCriticalSectionProvider( $limit);}, 'CryptHKDF'=> static function(MediaWikiServices $services):CryptHKDF { $config=$services->getMainConfig();$secret=$config->get(MainConfigNames::HKDFSecret) ?:$config->get(MainConfigNames::SecretKey);if(! $secret) { throw new RuntimeException("Cannot use MWCryptHKDF without a secret.");} $context=[microtime(), getmypid(), gethostname()];$cache=$services->getLocalServerObjectCache();if( $cache instanceof EmptyBagOStuff) { $cache=ObjectCache::getLocalClusterInstance();} return new CryptHKDF( $secret, $config->get(MainConfigNames::HKDFAlgorithm), $cache, $context);}, 'DatabaseBlockStore'=> static function(MediaWikiServices $services):DatabaseBlockStore { return $services->getDatabaseBlockStoreFactory() ->getDatabaseBlockStore(DatabaseBlock::LOCAL);}, 'DatabaseBlockStoreFactory'=> static function(MediaWikiServices $services):DatabaseBlockStoreFactory { return new DatabaseBlockStoreFactory(new ServiceOptions(DatabaseBlockStoreFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), LoggerFactory::getInstance( 'DatabaseBlockStore'), $services->getActorStoreFactory(), $services->getBlockRestrictionStoreFactory(), $services->getCommentStore(), $services->getHookContainer(), $services->getDBLoadBalancerFactory(), $services->getConfiguredReadOnlyMode(), $services->getUserFactory());}, 'DatabaseFactory'=> static function(MediaWikiServices $services):DatabaseFactory { return new DatabaseFactory();}, 'DateFormatterFactory'=> static function(MediaWikiServices $services):DateFormatterFactory { return new DateFormatterFactory();}, 'DBLoadBalancer'=> static function(MediaWikiServices $services):Wikimedia\Rdbms\ILoadBalancer { return $services->getDBLoadBalancerFactory() ->getMainLB();}, 'DBLoadBalancerFactory'=> static function(MediaWikiServices $services):Wikimedia\Rdbms\LBFactory { $mainConfig=$services->getMainConfig();$lbFactoryConfigBuilder=$services->getDBLoadBalancerFactoryConfigBuilder();$lbConf=$lbFactoryConfigBuilder->applyDefaultConfig($mainConfig->get(MainConfigNames::LBFactoryConf));$class=$lbFactoryConfigBuilder->getLBFactoryClass( $lbConf);$instance=new $class( $lbConf);$lbFactoryConfigBuilder->setDomainAliases( $instance);$lbFactoryConfigBuilder->applyGlobalState($instance, $mainConfig, $services->getStatsdDataFactory());return $instance;}, 'DBLoadBalancerFactoryConfigBuilder'=> static function(MediaWikiServices $services):MWLBFactory { $cpStashType=$services->getMainConfig() ->get(MainConfigNames::ChronologyProtectorStash);if(is_string( $cpStashType)) { $cpStash=ObjectCache::getInstance( $cpStashType);} else { try { $cpStash=ObjectCache::getLocalClusterInstance();} catch(RecursiveServiceDependencyException $e) { $cpStash=new EmptyBagOStuff();} } try { $wanCache=$services->getMainWANObjectCache();} catch(RecursiveServiceDependencyException $e) { $wanCache=WANObjectCache::newEmpty();} $srvCache=$services->getLocalServerObjectCache();if( $srvCache instanceof EmptyBagOStuff) { $srvCache=new HashBagOStuff([ 'maxKeys'=> 100]);} return new MWLBFactory(new ServiceOptions(MWLBFactory::APPLY_DEFAULT_CONFIG_OPTIONS, $services->getMainConfig()), $services->getConfiguredReadOnlyMode(), $cpStash, $srvCache, $wanCache, $services->getCriticalSectionProvider(), $services->getStatsdDataFactory(), $services->getDatabaseFactory());}, 'DeletePageFactory'=> static function(MediaWikiServices $services):DeletePageFactory { return $services->getService( '_PageCommandFactory');}, 'Emailer'=> static function(MediaWikiServices $services):IEmailer { return new Emailer();}, 'EventRelayerGroup'=> static function(MediaWikiServices $services):EventRelayerGroup { return new EventRelayerGroup( $services->getMainConfig() ->get(MainConfigNames::EventRelayerConfig));}, 'ExternalStoreAccess'=> static function(MediaWikiServices $services):ExternalStoreAccess { return new ExternalStoreAccess($services->getExternalStoreFactory(), LoggerFactory::getInstance( 'ExternalStore'));}, 'ExternalStoreFactory'=> static function(MediaWikiServices $services):ExternalStoreFactory { $config=$services->getMainConfig();$writeStores=$config->get(MainConfigNames::DefaultExternalStore);return new ExternalStoreFactory($config->get(MainConfigNames::ExternalStores),( $writeStores !==false) ?(array) $writeStores :[], $services->getDBLoadBalancer() ->getLocalDomainID(), LoggerFactory::getInstance( 'ExternalStore'));}, 'FileBackendGroup'=> static function(MediaWikiServices $services):FileBackendGroup { $mainConfig=$services->getMainConfig();$ld=WikiMap::getCurrentWikiDbDomain();$fallbackWikiId=WikiMap::getWikiIdFromDbDomain( $ld);$legacyDomainId=strlen( $ld->getTablePrefix()) ? "{$ld->getDatabase()}-{$ld->getTablePrefix()}" :$ld->getDatabase();if( $ld->getSchema() !==null && $legacyDomainId !==$fallbackWikiId) { wfWarn("Legacy default 'domainId' is '$legacyDomainId' but wiki ID is '$fallbackWikiId'.");} $cache=$services->getLocalServerObjectCache();if( $cache instanceof EmptyBagOStuff) { $cache=new HashBagOStuff();} return new FileBackendGroup(new ServiceOptions(FileBackendGroup::CONSTRUCTOR_OPTIONS, $mainConfig, [ 'fallbackWikiId'=> $fallbackWikiId]), $services->getConfiguredReadOnlyMode(), $cache, $services->getMainWANObjectCache(), $services->getMimeAnalyzer(), $services->getLockManagerGroupFactory(), $services->getTempFSFileFactory(), $services->getObjectFactory());}, 'GenderCache'=> static function(MediaWikiServices $services):GenderCache { $nsInfo=$services->getNamespaceInfo();$dbLoadBalancer=$services->isServiceDisabled( 'DBLoadBalancer') ? null :$services->getDBLoadBalancer();return new GenderCache( $nsInfo, $dbLoadBalancer, $services->get( '_DefaultOptionsLookup'));}, 'GlobalIdGenerator'=> static function(MediaWikiServices $services):GlobalIdGenerator { $mainConfig=$services->getMainConfig();return new GlobalIdGenerator($mainConfig->get(MainConfigNames::TmpDirectory), static function( $command) { return wfShellExec( $command);});}, 'GrantsInfo'=> static function(MediaWikiServices $services):GrantsInfo { return new GrantsInfo(new ServiceOptions(GrantsInfo::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'GrantsLocalization'=> static function(MediaWikiServices $services):GrantsLocalization { return new GrantsLocalization($services->getGrantsInfo(), $services->getLinkRenderer(), $services->getLanguageFactory(), $services->getContentLanguage());}, 'GroupPermissionsLookup'=> static function(MediaWikiServices $services):GroupPermissionsLookup { return new GroupPermissionsLookup(new ServiceOptions(GroupPermissionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'HookContainer'=> static function(MediaWikiServices $services):HookContainer { $configHooks=$services->getBootstrapConfig() ->get(MainConfigNames::Hooks);if( $configHooks instanceof FauxGlobalHookArray) { $configHooks=$configHooks->getOriginalArray();} $extRegistry=ExtensionRegistry::getInstance();$extHooks=$extRegistry->getAttribute( 'Hooks');$extDeprecatedHooks=$extRegistry->getAttribute( 'DeprecatedHooks');$hookRegistry=new StaticHookRegistry( $configHooks, $extHooks, $extDeprecatedHooks);$hookContainer=new HookContainer($hookRegistry, $services->getObjectFactory());return $hookContainer;}, 'HtmlCacheUpdater'=> static function(MediaWikiServices $services):HtmlCacheUpdater { $config=$services->getMainConfig();return new HtmlCacheUpdater($services->getHookContainer(), $services->getTitleFactory(), $config->get(MainConfigNames::CdnReboundPurgeDelay), $config->get(MainConfigNames::UseFileCache), $config->get(MainConfigNames::CdnMaxAge));}, 'HtmlTransformFactory'=> static function(MediaWikiServices $services):HtmlTransformFactory { return new HtmlTransformFactory($services->getService( '_Parsoid'), $services->getMainConfig() ->get(MainConfigNames::ParsoidSettings), $services->getParsoidPageConfigFactory(), $services->getContentHandlerFactory(), $services->getParsoidSiteConfig(), $services->getTitleFactory(), $services->getLanguageConverterFactory(), $services->getLanguageFactory());}, 'HttpRequestFactory'=> static function(MediaWikiServices $services):HttpRequestFactory { return new HttpRequestFactory(new ServiceOptions(HttpRequestFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), LoggerFactory::getInstance( 'http'));}, 'InterwikiLookup'=> static function(MediaWikiServices $services):InterwikiLookup { return new ClassicInterwikiLookup(new ServiceOptions(ClassicInterwikiLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig(), [ 'wikiId'=> WikiMap::getCurrentWikiId()]), $services->getContentLanguage(), $services->getMainWANObjectCache(), $services->getHookContainer(), $services->getDBLoadBalancer());}, 'JobFactory'=> static function(MediaWikiServices $services):JobFactory { return new JobFactory($services->getObjectFactory(), $services->getMainConfig() ->get(MainConfigNames::JobClasses));}, 'JobQueueGroup'=> static function(MediaWikiServices $services):JobQueueGroup { return $services->getJobQueueGroupFactory() ->makeJobQueueGroup();}, 'JobQueueGroupFactory'=> static function(MediaWikiServices $services):JobQueueGroupFactory { return new JobQueueGroupFactory(new ServiceOptions(JobQueueGroupFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getConfiguredReadOnlyMode(), $services->getStatsdDataFactory(), $services->getMainWANObjectCache(), $services->getGlobalIdGenerator());}, 'JobRunner'=> static function(MediaWikiServices $services):JobRunner { return new JobRunner(new ServiceOptions(JobRunner::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getDBLoadBalancerFactory(), $services->getJobQueueGroup(), $services->getReadOnlyMode(), $services->getLinkCache(), $services->getStatsdDataFactory(), LoggerFactory::getInstance( 'runJobs'));}, 'JsonCodec'=> static function(MediaWikiServices $services):JsonCodec { return new JsonCodec();}, 'LanguageConverterFactory'=> static function(MediaWikiServices $services):LanguageConverterFactory { $usePigLatinVariant=$services->getMainConfig() ->get(MainConfigNames::UsePigLatinVariant);$isConversionDisabled=$services->getMainConfig() ->get(MainConfigNames::DisableLangConversion);$isTitleConversionDisabled=$services->getMainConfig() ->get(MainConfigNames::DisableTitleConversion);return new LanguageConverterFactory($services->getObjectFactory(), $usePigLatinVariant, $isConversionDisabled, $isTitleConversionDisabled, static function() use( $services) { return $services->getContentLanguage();});}, 'LanguageFactory'=> static function(MediaWikiServices $services):LanguageFactory { return new LanguageFactory(new ServiceOptions(LanguageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getNamespaceInfo(), $services->getLocalisationCache(), $services->getLanguageNameUtils(), $services->getLanguageFallback(), $services->getLanguageConverterFactory(), $services->getHookContainer(), $services->getMainConfig());}, 'LanguageFallback'=> static function(MediaWikiServices $services):LanguageFallback { return new LanguageFallback($services->getMainConfig() ->get(MainConfigNames::LanguageCode), $services->getLocalisationCache(), $services->getLanguageNameUtils());}, 'LanguageNameUtils'=> static function(MediaWikiServices $services):LanguageNameUtils { return new LanguageNameUtils(new ServiceOptions(LanguageNameUtils::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getHookContainer());}, 'LinkBatchFactory'=> static function(MediaWikiServices $services):LinkBatchFactory { return new LinkBatchFactory($services->getLinkCache(), $services->getTitleFormatter(), $services->getContentLanguage(), $services->getGenderCache(), $services->getDBLoadBalancer(), $services->getLinksMigration(), LoggerFactory::getInstance( 'LinkBatch'));}, 'LinkCache'=> static function(MediaWikiServices $services):LinkCache { $dbLoadBalancer=$services->isServiceDisabled( 'DBLoadBalancer') ? null :$services->getDBLoadBalancer();$linkCache=new LinkCache($services->getTitleFormatter(), $services->getMainWANObjectCache(), $services->getNamespaceInfo(), $dbLoadBalancer);$linkCache->setLogger(LoggerFactory::getInstance( 'LinkCache'));return $linkCache;}, 'LinkRenderer'=> static function(MediaWikiServices $services):LinkRenderer { return $services->getLinkRendererFactory() ->create();}, 'LinkRendererFactory'=> static function(MediaWikiServices $services):LinkRendererFactory { return new LinkRendererFactory($services->getTitleFormatter(), $services->getLinkCache(), $services->getSpecialPageFactory(), $services->getHookContainer());}, 'LinksMigration'=> static function(MediaWikiServices $services):LinksMigration { return new LinksMigration($services->getMainConfig(), $services->getLinkTargetLookup());}, 'LinkTargetLookup'=> static function(MediaWikiServices $services):LinkTargetLookup { return new LinkTargetStore($services->getDBLoadBalancer(), $services->getLocalServerObjectCache(), $services->getMainWANObjectCache());}, 'LocalisationCache'=> static function(MediaWikiServices $services):LocalisationCache { $conf=$services->getMainConfig() ->get(MainConfigNames::LocalisationCacheConf);$logger=LoggerFactory::getInstance( 'localisation');$store=LocalisationCache::getStoreFromConf($conf, $services->getMainConfig() ->get(MainConfigNames::CacheDirectory));$logger->debug( 'LocalisationCache using store ' . get_class( $store));return new $conf['class'](new ServiceOptions(LocalisationCache::CONSTRUCTOR_OPTIONS, $conf, ['forceRecache'=> false, 'manualRecache'=> false,], $services->getMainConfig()), $store, $logger, [static function() use( $services) { MessageBlobStore::clearGlobalCacheEntry( $services->getMainWANObjectCache());}], $services->getLanguageNameUtils(), $services->getHookContainer());}, 'LocalServerObjectCache'=> static function(MediaWikiServices $services):BagOStuff { return ObjectCache::makeLocalServerCache();}, 'LockManagerGroupFactory'=> static function(MediaWikiServices $services):LockManagerGroupFactory { return new LockManagerGroupFactory(WikiMap::getCurrentWikiDbDomain() ->getId(), $services->getMainConfig() ->get(MainConfigNames::LockManagers));}, 'MagicWordFactory'=> static function(MediaWikiServices $services):MagicWordFactory { return new MagicWordFactory($services->getContentLanguage(), $services->getHookContainer());}, 'MainConfig'=> static function(MediaWikiServices $services):Config { return $services->getConfigFactory() ->makeConfig( 'main');}, 'MainObjectStash'=> static function(MediaWikiServices $services):BagOStuff { $mainConfig=$services->getMainConfig();$id=$mainConfig->get(MainConfigNames::MainStash);$params=$mainConfig->get(MainConfigNames::ObjectCaches)[$id] ?? null;if(! $params) { throw new UnexpectedValueException("\$wgObjectCaches must have \"$id\" set (via \$wgMainStash)");} $store=ObjectCache::newFromParams( $params, $services);$store->getLogger() ->debug( 'MainObjectStash using store {class}', ['class'=> get_class( $store)]);return $store;}, 'MainWANObjectCache'=> static function(MediaWikiServices $services):WANObjectCache { $mainConfig=$services->getMainConfig();$store=$services->get( '_LocalClusterCache');$logger=$store->getLogger();$logger->debug( 'MainWANObjectCache using store {class}', ['class'=> get_class( $store)]);$wanParams=$mainConfig->get(MainConfigNames::WANObjectCache)+['cache'=> $store, 'logger'=> $logger, 'secret'=> $mainConfig->get(MainConfigNames::SecretKey),];if(! $GLOBALS[ 'wgCommandLineMode']) { $wanParams['stats']=$services->getStatsdDataFactory();$wanParams['asyncHandler']=[DeferredUpdates::class, 'addCallableUpdate'];} return new WANObjectCache( $wanParams);}, 'MediaHandlerFactory'=> static function(MediaWikiServices $services):MediaHandlerFactory { return new MediaHandlerFactory(LoggerFactory::getInstance( 'MediaHandlerFactory'), $services->getMainConfig() ->get(MainConfigNames::MediaHandlers));}, 'MergeHistoryFactory'=> static function(MediaWikiServices $services):MergeHistoryFactory { return $services->getService( '_PageCommandFactory');}, 'MessageCache'=> static function(MediaWikiServices $services):MessageCache { $mainConfig=$services->getMainConfig();$clusterCache=ObjectCache::getInstance( $mainConfig->get(MainConfigNames::MessageCacheType));$srvCache=$mainConfig->get(MainConfigNames::UseLocalMessageCache) ? $services->getLocalServerObjectCache() :new EmptyBagOStuff();$logger=LoggerFactory::getInstance( 'MessageCache');$logger->debug( 'MessageCache using store {class}', ['class'=> get_class( $clusterCache)]);$options=new ServiceOptions(MessageCache::CONSTRUCTOR_OPTIONS, $mainConfig);return new MessageCache($services->getMainWANObjectCache(), $clusterCache, $srvCache, $services->getContentLanguage(), $services->getLanguageConverterFactory(), $logger, $options, $services->getLanguageFactory(), $services->getLocalisationCache(), $services->getLanguageNameUtils(), $services->getLanguageFallback(), $services->getHookContainer());}, 'MessageFormatterFactory'=> static function(MediaWikiServices $services):IMessageFormatterFactory { return new MessageFormatterFactory();}, 'MimeAnalyzer'=> static function(MediaWikiServices $services):MimeAnalyzer { $logger=LoggerFactory::getInstance( 'Mime');$mainConfig=$services->getMainConfig();$hookRunner=new HookRunner( $services->getHookContainer());$params=['typeFile'=> $mainConfig->get(MainConfigNames::MimeTypeFile), 'infoFile'=> $mainConfig->get(MainConfigNames::MimeInfoFile), 'xmlTypes'=> $mainConfig->get(MainConfigNames::XMLMimeTypes), 'guessCallback'=> static function( $mimeAnalyzer, &$head, &$tail, $file, &$mime) use( $logger, $hookRunner) { $deja=new DjVuImage( $file);if( $deja->isValid()) { $logger->info("Detected $file as image/vnd.djvu\n");$mime='image/vnd.djvu';return;} $hookRunner->onMimeMagicGuessFromContent($mimeAnalyzer, $head, $tail, $file, $mime);}, 'extCallback'=> static function( $mimeAnalyzer, $ext, &$mime) use( $hookRunner) { $hookRunner->onMimeMagicImproveFromExtension( $mimeAnalyzer, $ext, $mime);}, 'initCallback'=> static function( $mimeAnalyzer) use( $hookRunner) { $hookRunner->onMimeMagicInit( $mimeAnalyzer);}, 'logger'=> $logger];if( $params['infoFile']==='includes/mime.info') { $params['infoFile']=MimeAnalyzer::USE_INTERNAL;} if( $params['typeFile']==='includes/mime.types') { $params['typeFile']=MimeAnalyzer::USE_INTERNAL;} $detectorCmd=$mainConfig->get(MainConfigNames::MimeDetectorCommand);if( $detectorCmd) { $factory=$services->getShellCommandFactory();$params['detectCallback']=static function( $file) use( $detectorCmd, $factory) { $result=$factory->create() ->unsafeParams( $detectorCmd) ->params( $file) ->execute();return $result->getStdout();};} return new MimeAnalyzer( $params);}, 'MovePageFactory'=> static function(MediaWikiServices $services):MovePageFactory { return $services->getService( '_PageCommandFactory');}, 'NamespaceInfo'=> static function(MediaWikiServices $services):NamespaceInfo { return new NamespaceInfo(new ServiceOptions(NamespaceInfo::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getHookContainer());}, 'NameTableStoreFactory'=> static function(MediaWikiServices $services):NameTableStoreFactory { return new NameTableStoreFactory($services->getDBLoadBalancerFactory(), $services->getMainWANObjectCache(), LoggerFactory::getInstance( 'NameTableSqlStore'));}, 'ObjectFactory'=> static function(MediaWikiServices $services):ObjectFactory { return new ObjectFactory( $services);}, 'OldRevisionImporter'=> static function(MediaWikiServices $services):OldRevisionImporter { return new ImportableOldRevisionImporter(true, LoggerFactory::getInstance( 'OldRevisionImporter'), $services->getDBLoadBalancer(), $services->getRevisionStore(), $services->getSlotRoleRegistry(), $services->getWikiPageFactory(), $services->getPageUpdaterFactory(), $services->getUserFactory());}, 'PageEditStash'=> static function(MediaWikiServices $services):PageEditStash { return new PageEditStash(ObjectCache::getLocalClusterInstance(), $services->getDBLoadBalancer(), LoggerFactory::getInstance( 'StashEdit'), $services->getStatsdDataFactory(), $services->getUserEditTracker(), $services->getUserFactory(), $services->getWikiPageFactory(), $services->getHookContainer(), defined( 'MEDIAWIKI_JOB_RUNNER')|| $GLOBALS[ 'wgCommandLineMode'] ? PageEditStash::INITIATOR_JOB_OR_CLI :PageEditStash::INITIATOR_USER);}, 'PageProps'=> static function(MediaWikiServices $services):PageProps { return new PageProps($services->getLinkBatchFactory(), $services->getDBLoadBalancer());}, 'PageRestHelperFactory'=> static function(MediaWikiServices $services):PageRestHelperFactory { return new PageRestHelperFactory(new ServiceOptions(PageRestHelperFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getRevisionLookup(), $services->getTitleFormatter(), $services->getPageStore(), $services->getParsoidOutputStash(), $services->getStatsdDataFactory(), $services->getParsoidOutputAccess(), $services->getHtmlTransformFactory(), $services->getContentHandlerFactory(), $services->getLanguageFactory());}, 'PageStore'=> static function(MediaWikiServices $services):PageStore { return $services->getPageStoreFactory() ->getPageStore();}, 'PageStoreFactory'=> static function(MediaWikiServices $services):PageStoreFactory { $options=new ServiceOptions(PageStoreFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig());return new PageStoreFactory($options, $services->getDBLoadBalancerFactory(), $services->getNamespaceInfo(), $services->getTitleParser(), $services->getLinkCache(), $services->getStatsdDataFactory());}, 'PageUpdaterFactory'=> static function(MediaWikiServices $services):PageUpdaterFactory { $editResultCache=new EditResultCache($services->getMainObjectStash(), $services->getDBLoadBalancer(), new ServiceOptions(EditResultCache::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));return new PageUpdaterFactory($services->getRevisionStore(), $services->getRevisionRenderer(), $services->getSlotRoleRegistry(), $services->getParserCache(), $services->getParsoidOutputAccess(), $services->getJobQueueGroup(), $services->getMessageCache(), $services->getContentLanguage(), $services->getDBLoadBalancerFactory(), $services->getContentHandlerFactory(), $services->getHookContainer(), $editResultCache, $services->getUserNameUtils(), LoggerFactory::getInstance( 'SavePage'), new ServiceOptions(PageUpdaterFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getUserEditTracker(), $services->getUserGroupManager(), $services->getTitleFormatter(), $services->getContentTransformer(), $services->getPageEditStash(), $services->getTalkPageNotificationManager(), $services->getMainWANObjectCache(), $services->getPermissionManager(), $services->getWikiPageFactory(), ChangeTags::getSoftwareTags());}, 'Parser'=> static function(MediaWikiServices $services):Parser { return $services->getParserFactory() ->getMainInstance();}, 'ParserCache'=> static function(MediaWikiServices $services):ParserCache { return $services->getParserCacheFactory() ->getParserCache(ParserCacheFactory::DEFAULT_NAME);}, 'ParserCacheFactory'=> static function(MediaWikiServices $services):ParserCacheFactory { $config=$services->getMainConfig();$cache=ObjectCache::getInstance( $config->get(MainConfigNames::ParserCacheType));$wanCache=$services->getMainWANObjectCache();$options=new ServiceOptions(ParserCacheFactory::CONSTRUCTOR_OPTIONS, $config);return new ParserCacheFactory($cache, $wanCache, $services->getHookContainer(), $services->getJsonCodec(), $services->getStatsdDataFactory(), LoggerFactory::getInstance( 'ParserCache'), $options, $services->getTitleFactory(), $services->getWikiPageFactory());}, 'ParserFactory'=> static function(MediaWikiServices $services):ParserFactory { $options=new ServiceOptions(Parser::CONSTRUCTOR_OPTIONS, $services->getMainConfig());return new ParserFactory($options, $services->getMagicWordFactory(), $services->getContentLanguage(), $services->getUrlUtils(), $services->getSpecialPageFactory(), $services->getLinkRendererFactory(), $services->getNamespaceInfo(), LoggerFactory::getInstance( 'Parser'), $services->getBadFileLookup(), $services->getLanguageConverterFactory(), $services->getHookContainer(), $services->getTidy(), $services->getMainWANObjectCache(), $services->getUserOptionsLookup(), $services->getUserFactory(), $services->getTitleFormatter(), $services->getHttpRequestFactory(), $services->getTrackingCategories(), $services->getSignatureValidatorFactory(), $services->getUserNameUtils());}, 'ParserOutputAccess'=> static function(MediaWikiServices $services):ParserOutputAccess { return new ParserOutputAccess($services->getParserCache(), $services->getParserCacheFactory() ->getRevisionOutputCache( 'rcache'), $services->getRevisionLookup(), $services->getRevisionRenderer(), $services->getStatsdDataFactory(), $services->getDBLoadBalancerFactory(), LoggerFactory::getProvider(), $services->getWikiPageFactory(), $services->getTitleFormatter());}, 'ParsoidDataAccess'=> static function(MediaWikiServices $services):DataAccess { $mainConfig=$services->getMainConfig();$parsoidSettings=$mainConfig->get(MainConfigNames::ParsoidSettings);if(!empty( $parsoidSettings['debugApi'])) { return ApiDataAccess::fromSettings( $parsoidSettings);} return new MWDataAccess(new ServiceOptions(MWDataAccess::CONSTRUCTOR_OPTIONS, $mainConfig), $services->getRepoGroup(), $services->getBadFileLookup(), $services->getHookContainer(), $services->getContentTransformer(), $services->getReadOnlyMode(), $services->getParserFactory(), $services->getLinkBatchFactory());}, 'ParsoidOutputAccess'=> static function(MediaWikiServices $services):ParsoidOutputAccess { return new ParsoidOutputAccess(new ServiceOptions(ParsoidOutputAccess::CONSTRUCTOR_OPTIONS, $services->getMainConfig(), [ 'ParsoidWikiID'=> WikiMap::getCurrentWikiId()]), $services->getParserCacheFactory(), $services->getPageStore(), $services->getRevisionLookup(), $services->getGlobalIdGenerator(), $services->getStatsdDataFactory(), $services->getService( '_Parsoid'), $services->getParsoidSiteConfig(), $services->getParsoidPageConfigFactory(), $services->getContentHandlerFactory());}, 'ParsoidOutputStash'=> static function(MediaWikiServices $services):ParsoidOutputStash { $config=$services->getMainConfig() ->get(MainConfigNames::ParsoidCacheConfig);$backend=$config['StashType'] ? ObjectCache::getInstance( $config['StashType']) :$services->getMainObjectStash();return new SimpleParsoidOutputStash($services->getContentHandlerFactory(), $backend, $config['StashDuration']);}, 'ParsoidPageConfigFactory'=> static function(MediaWikiServices $services):MWPageConfigFactory { return new MWPageConfigFactory($services->getRevisionStore(), $services->getSlotRoleRegistry(), $services->getLanguageFactory());}, 'ParsoidSiteConfig'=> static function(MediaWikiServices $services):SiteConfig { $mainConfig=$services->getMainConfig();$parsoidSettings=$mainConfig->get(MainConfigNames::ParsoidSettings);if(!empty( $parsoidSettings['debugApi'])) { return ApiSiteConfig::fromSettings( $parsoidSettings);} return new MWSiteConfig(new ServiceOptions(MWSiteConfig::CONSTRUCTOR_OPTIONS, $mainConfig), $parsoidSettings, $services->getObjectFactory(), $services->getContentLanguage(), $services->getStatsdDataFactory(), $services->getMagicWordFactory(), $services->getNamespaceInfo(), $services->getSpecialPageFactory(), $services->getInterwikiLookup(), $services->getUserOptionsLookup(), $services->getLanguageFactory(), $services->getLanguageConverterFactory(), $services->getLanguageNameUtils(), $services->getUrlUtils(), $services->getParser(), $mainConfig);}, 'PasswordFactory'=> static function(MediaWikiServices $services):PasswordFactory { $config=$services->getMainConfig();return new PasswordFactory($config->get(MainConfigNames::PasswordConfig), $config->get(MainConfigNames::PasswordDefault));}, 'PasswordReset'=> static function(MediaWikiServices $services):PasswordReset { $options=new ServiceOptions(PasswordReset::CONSTRUCTOR_OPTIONS, $services->getMainConfig());return new PasswordReset($options, LoggerFactory::getInstance( 'authentication'), $services->getAuthManager(), $services->getHookContainer(), $services->getDBLoadBalancer(), $services->getUserFactory(), $services->getUserNameUtils(), $services->getUserOptionsLookup());}, 'PerDbNameStatsdDataFactory'=> static function(MediaWikiServices $services):StatsdDataFactoryInterface { $config=$services->getMainConfig();$wiki=$config->get(MainConfigNames::DBname);return new PrefixingStatsdDataFactoryProxy($services->getStatsdDataFactory(), $wiki);}, 'PermissionManager'=> static function(MediaWikiServices $services):PermissionManager { return new PermissionManager(new ServiceOptions(PermissionManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getSpecialPageFactory(), $services->getNamespaceInfo(), $services->getGroupPermissionsLookup(), $services->getUserGroupManager(), $services->getBlockErrorFormatter(), $services->getHookContainer(), $services->getUserCache(), $services->getRedirectLookup(), $services->getRestrictionStore(), $services->getTitleFormatter(), $services->getTempUserConfig(), $services->getUserFactory(), $services->getActionFactory());}, 'PoolCounterFactory'=> static function(MediaWikiServices $services):PoolCounterFactory { $mainConfig=$services->getMainConfig();return new PoolCounterFactory($mainConfig->get(MainConfigNames::PoolCounterConf), $mainConfig->get(MainConfigNames::PoolCountClientConf));}, 'PreferencesFactory'=> static function(MediaWikiServices $services):PreferencesFactory { $factory=new DefaultPreferencesFactory(new ServiceOptions(DefaultPreferencesFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getContentLanguage(), $services->getAuthManager(), $services->getLinkRendererFactory() ->create(), $services->getNamespaceInfo(), $services->getPermissionManager(), $services->getLanguageConverterFactory() ->getLanguageConverter(), $services->getLanguageNameUtils(), $services->getHookContainer(), $services->getUserOptionsManager(), $services->getLanguageConverterFactory(), $services->getParser(), $services->getSkinFactory(), $services->getUserGroupManager(), $services->getSignatureValidatorFactory(), $services->getMainConfig());$factory->setLogger(LoggerFactory::getInstance( 'preferences'));return $factory;}, 'ProxyLookup'=> static function(MediaWikiServices $services):ProxyLookup { $mainConfig=$services->getMainConfig();return new ProxyLookup($mainConfig->get(MainConfigNames::CdnServers), $mainConfig->get(MainConfigNames::CdnServersNoPurge), $services->getHookContainer());}, 'RateLimiter'=> static function(MediaWikiServices $services):RateLimiter { return new RateLimiter(new ServiceOptions(RateLimiter::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getWRStatsFactory(), $services->getCentralIdLookupFactory() ->getNonLocalLookup(), $services->getUserFactory(), $services->getUserGroupManager(), $services->getHookContainer());}, 'ReadOnlyMode'=> static function(MediaWikiServices $services):ReadOnlyMode { return new ReadOnlyMode($services->getConfiguredReadOnlyMode(), $services->getDBLoadBalancer());}, 'RedirectLookup'=> static function(MediaWikiServices $services):RedirectLookup { return $services->getRedirectStore();}, 'RedirectStore'=> static function(MediaWikiServices $services):RedirectStore { return new RedirectStore( $services->getWikiPageFactory());}, 'RepoGroup'=> static function(MediaWikiServices $services):RepoGroup { $config=$services->getMainConfig();return new RepoGroup($config->get(MainConfigNames::LocalFileRepo), $config->get(MainConfigNames::ForeignFileRepos), $services->getMainWANObjectCache(), $services->getMimeAnalyzer());}, 'ResourceLoader'=> static function(MediaWikiServices $services):ResourceLoader { $config=$services->getMainConfig();$maxage=$config->get(MainConfigNames::ResourceLoaderMaxage);$rl=new ResourceLoader($config, LoggerFactory::getInstance( 'resourceloader'), $config->get(MainConfigNames::ResourceLoaderUseObjectCacheForDeps) ? new KeyValueDependencyStore( $services->getMainObjectStash()) :new SqlModuleDependencyStore( $services->getDBLoadBalancer()), ['loadScript'=> $config->get(MainConfigNames::LoadScript), 'maxageVersioned'=> $maxage['versioned'] ?? null, 'maxageUnversioned'=> $maxage['unversioned'] ?? null, 'useFileCache'=> $config->get(MainConfigNames::UseFileCache),]);$extRegistry=ExtensionRegistry::getInstance();$modules=$extRegistry->getAttribute( 'ResourceModules')+ $config->get(MainConfigNames::ResourceModules);$moduleSkinStyles=$extRegistry->getAttribute( 'ResourceModuleSkinStyles')+ $config->get(MainConfigNames::ResourceModuleSkinStyles);$rl->setModuleSkinStyles( $moduleSkinStyles);$rl->addSource( $config->get(MainConfigNames::ResourceLoaderSources));$baseDir=$config->get(MainConfigNames::BaseDirectory);$rl->register(include "$baseDir/resources/Resources.php");$rl->register( $modules);$hookRunner=new \MediaWiki\ResourceLoader\HookRunner( $services->getHookContainer());$hookRunner->onResourceLoaderRegisterModules( $rl);$msgPosterAttrib=$extRegistry->getAttribute( 'MessagePosterModule');$rl->register( 'mediawiki.messagePoster', ['localBasePath'=> $baseDir, 'debugRaw'=> false, 'scripts'=> array_merge(["resources/src/mediawiki.messagePoster/factory.js", "resources/src/mediawiki.messagePoster/MessagePoster.js", "resources/src/mediawiki.messagePoster/WikitextMessagePoster.js",], $msgPosterAttrib['scripts'] ??[]), 'dependencies'=> array_merge(['oojs', 'mediawiki.api', 'mediawiki.ForeignApi',], $msgPosterAttrib['dependencies'] ??[]), 'targets'=>[ 'desktop', 'mobile'],]);if( $config->get(MainConfigNames::EnableJavaScriptTest)===true) { $rl->registerTestModules();} return $rl;}, 'RestrictionStore'=> static function(MediaWikiServices $services):RestrictionStore { return new RestrictionStore(new ServiceOptions(RestrictionStore::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getMainWANObjectCache(), $services->getDBLoadBalancer(), $services->getLinkCache(), $services->getLinksMigration(), $services->getCommentStore(), $services->getHookContainer(), $services->getPageStore());}, 'RevertedTagUpdateManager'=> static function(MediaWikiServices $services):RevertedTagUpdateManager { $editResultCache=new EditResultCache($services->getMainObjectStash(), $services->getDBLoadBalancer(), new ServiceOptions(EditResultCache::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));return new RevertedTagUpdateManager($editResultCache, $services->getJobQueueGroup());}, 'RevisionFactory'=> static function(MediaWikiServices $services):RevisionFactory { return $services->getRevisionStore();}, 'RevisionLookup'=> static function(MediaWikiServices $services):RevisionLookup { return $services->getRevisionStore();}, 'RevisionRenderer'=> static function(MediaWikiServices $services):RevisionRenderer { $renderer=new RevisionRenderer($services->getDBLoadBalancer(), $services->getSlotRoleRegistry(), $services->getContentRenderer());$renderer->setLogger(LoggerFactory::getInstance( 'SaveParse'));return $renderer;}, 'RevisionStore'=> static function(MediaWikiServices $services):RevisionStore { return $services->getRevisionStoreFactory() ->getRevisionStore();}, 'RevisionStoreFactory'=> static function(MediaWikiServices $services):RevisionStoreFactory { return new RevisionStoreFactory($services->getDBLoadBalancerFactory(), $services->getBlobStoreFactory(), $services->getNameTableStoreFactory(), $services->getSlotRoleRegistry(), $services->getMainWANObjectCache(), $services->getLocalServerObjectCache(), $services->getCommentStore(), $services->getActorMigration(), $services->getActorStoreFactory(), LoggerFactory::getInstance( 'RevisionStore'), $services->getContentHandlerFactory(), $services->getPageStoreFactory(), $services->getTitleFactory(), $services->getHookContainer());}, 'RollbackPageFactory'=> static function(MediaWikiServices $services):RollbackPageFactory { return $services->get( '_PageCommandFactory');}, 'RowCommentFormatter'=> static function(MediaWikiServices $services):RowCommentFormatter { $parserFactory=new CommentParserFactory($services->getLinkRenderer(), $services->getLinkBatchFactory(), $services->getLinkCache(), $services->getRepoGroup(), RequestContext::getMain() ->getLanguage(), $services->getContentLanguage(), $services->getTitleParser(), $services->getNamespaceInfo(), $services->getHookContainer());return new RowCommentFormatter($parserFactory, $services->getCommentStore());}, 'SearchEngineConfig'=> static function(MediaWikiServices $services):SearchEngineConfig { return new SearchEngineConfig($services->getMainConfig(), $services->getContentLanguage(), $services->getHookContainer(), ExtensionRegistry::getInstance() ->getAttribute( 'SearchMappings'), $services->getUserOptionsLookup());}, 'SearchEngineFactory'=> static function(MediaWikiServices $services):SearchEngineFactory { return new SearchEngineFactory($services->getSearchEngineConfig(), $services->getHookContainer(), $services->getDBLoadBalancer());}, 'SearchResultThumbnailProvider'=> static function(MediaWikiServices $services):SearchResultThumbnailProvider { return new SearchResultThumbnailProvider($services->getRepoGroup(), $services->getHookContainer());}, 'ShellboxClientFactory'=> static function(MediaWikiServices $services):ShellboxClientFactory { $urls=$services->getMainConfig() ->get(MainConfigNames::ShellboxUrls);return new ShellboxClientFactory($services->getHttpRequestFactory(), $urls, $services->getMainConfig() ->get(MainConfigNames::ShellboxSecretKey));}, 'ShellCommandFactory'=> static function(MediaWikiServices $services):CommandFactory { $config=$services->getMainConfig();$limits=['time'=> $config->get(MainConfigNames::MaxShellTime), 'walltime'=> $config->get(MainConfigNames::MaxShellWallClockTime), 'memory'=> $config->get(MainConfigNames::MaxShellMemory), 'filesize'=> $config->get(MainConfigNames::MaxShellFileSize),];$cgroup=$config->get(MainConfigNames::ShellCgroup);$restrictionMethod=$config->get(MainConfigNames::ShellRestrictionMethod);$factory=new CommandFactory( $services->getShellboxClientFactory(), $limits, $cgroup, $restrictionMethod);$factory->setLogger(LoggerFactory::getInstance( 'exec'));$factory->logStderr();return $factory;}, 'SignatureValidatorFactory'=> static function(MediaWikiServices $services):SignatureValidatorFactory { return new SignatureValidatorFactory(new ServiceOptions(SignatureValidator::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), static function() use( $services) { return $services->getParserFactory();}, $services->getSpecialPageFactory(), $services->getTitleFactory());}, 'SiteLookup'=> static function(MediaWikiServices $services):SiteLookup { return $services->getSiteStore();}, 'SiteStore'=> static function(MediaWikiServices $services):SiteStore { $rawSiteStore=new DBSiteStore( $services->getDBLoadBalancer());$cache=$services->getLocalServerObjectCache();if( $cache instanceof EmptyBagOStuff) { $cache=ObjectCache::getLocalClusterInstance();} return new CachingSiteStore( $rawSiteStore, $cache);}, 'SkinFactory'=> static function(MediaWikiServices $services):SkinFactory { $factory=new SkinFactory($services->getObjectFactory(),(array) $services->getMainConfig() ->get(MainConfigNames::SkipSkins));$names=$services->getMainConfig() ->get(MainConfigNames::ValidSkinNames);foreach( $names as $name=> $skin) { if(is_array( $skin)) { $spec=$skin;$displayName=$skin['displayname'] ?? $name;$skippable=$skin['skippable'] ?? null;} else { $displayName=$skin;$skippable=null;$spec=['name'=> $name, 'class'=> "Skin$skin"];} $factory->register( $name, $displayName, $spec, $skippable);} $factory->register( 'fallback', 'Fallback', ['class'=> SkinFallback::class, 'args'=>[['name'=> 'fallback', 'styles'=>[ 'mediawiki.skinning.interface'], 'templateDirectory'=> __DIR__ . '/skins/templates/fallback',]]], true);$factory->register( 'apioutput', 'ApiOutput', ['class'=> SkinApi::class, 'args'=>[['name'=> 'apioutput', 'styles'=>[ 'mediawiki.skinning.interface'], 'templateDirectory'=> __DIR__ . '/skins/templates/apioutput',]]], true);return $factory;}, 'SlotRoleRegistry'=> static function(MediaWikiServices $services):SlotRoleRegistry { $registry=new SlotRoleRegistry($services->getSlotRoleStore());$config=$services->getMainConfig();$contentHandlerFactory=$services->getContentHandlerFactory();$hookContainer=$services->getHookContainer();$titleFactory=$services->getTitleFactory();$registry->defineRole(SlotRecord::MAIN, static function() use( $config, $contentHandlerFactory, $hookContainer, $titleFactory) { return new MainSlotRoleHandler($config->get(MainConfigNames::NamespaceContentModels), $contentHandlerFactory, $hookContainer, $titleFactory);});return $registry;}, 'SlotRoleStore'=> static function(MediaWikiServices $services):NameTableStore { return $services->getNameTableStoreFactory() ->getSlotRoles();}, 'SpamChecker'=> static function(MediaWikiServices $services):SpamChecker { return new SpamChecker((array) $services->getMainConfig() ->get(MainConfigNames::SpamRegex),(array) $services->getMainConfig() ->get(MainConfigNames::SummarySpamRegex));}, 'SpecialPageFactory'=> static function(MediaWikiServices $services):SpecialPageFactory { return new SpecialPageFactory(new ServiceOptions(SpecialPageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getContentLanguage(), $services->getObjectFactory(), $services->getTitleFactory(), $services->getHookContainer());}, 'StatsCache'=> static function(MediaWikiServices $services):StatsCache { return new StatsCache();}, 'StatsdDataFactory'=> static function(MediaWikiServices $services):IBufferingStatsdDataFactory { return new BufferingStatsdDataFactory(rtrim( $services->getMainConfig() ->get(MainConfigNames::StatsdMetricPrefix), '.'));}, 'StatsFactory'=> static function(MediaWikiServices $services):StatsFactory { $config=$services->getMainConfig();$format=\Wikimedia\Stats\OutputFormats::getFormatFromString($config->get(MainConfigNames::StatsFormat) ?? 'null');$cache=$services->getService( 'StatsCache');$emitter=\Wikimedia\Stats\OutputFormats::getNewEmitter($config->get(MainConfigNames::StatsPrefix) ?? 'MediaWiki', $cache, \Wikimedia\Stats\OutputFormats::getNewFormatter( $format), $config->get(MainConfigNames::StatsTarget));$factory=new StatsFactory( 'core', $cache, $emitter, LoggerFactory::getInstance( 'Stats'));return $factory->withStatsdDataFactory( $services->getStatsdDataFactory());}, 'TalkPageNotificationManager'=> static function(MediaWikiServices $services):TalkPageNotificationManager { return new TalkPageNotificationManager(new ServiceOptions(TalkPageNotificationManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getDBLoadBalancer(), $services->getReadOnlyMode(), $services->getRevisionLookup(), $services->getHookContainer(), $services->getUserFactory());}, 'TempFSFileFactory'=> static function(MediaWikiServices $services):TempFSFileFactory { return new TempFSFileFactory( $services->getMainConfig() ->get(MainConfigNames::TmpDirectory));}, 'TempUserConfig'=> static function(MediaWikiServices $services):RealTempUserConfig { return new RealTempUserConfig($services->getMainConfig() ->get(MainConfigNames::AutoCreateTempUser));}, 'TempUserCreator'=> static function(MediaWikiServices $services):TempUserCreator { $accountCreationThrottle=$services->getMainConfig() ->get(MainConfigNames::AccountCreationThrottle);if(!is_array( $accountCreationThrottle)) { $accountCreationThrottle=[['count'=> $accountCreationThrottle, 'seconds'=> 86400,]];} return new TempUserCreator($services->getTempUserConfig(), $services->getObjectFactory(), $services->getUserFactory(), $services->getAuthManager(), new Throttler($accountCreationThrottle, ['type'=> 'acctcreate', 'cache'=> $services->getLocalServerObjectCache()]));}, 'Tidy'=> static function(MediaWikiServices $services):TidyDriverBase { return new RemexDriver(new ServiceOptions(RemexDriver::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'TitleFactory'=> static function(MediaWikiServices $services):TitleFactory { return new TitleFactory();}, 'TitleFormatter'=> static function(MediaWikiServices $services):TitleFormatter { return $services->getService( '_MediaWikiTitleCodec');}, 'TitleMatcher'=> static function(MediaWikiServices $services):TitleMatcher { return new TitleMatcher(new ServiceOptions(TitleMatcher::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getContentLanguage(), $services->getLanguageConverterFactory(), $services->getHookContainer(), $services->getWikiPageFactory(), $services->getUserNameUtils(), $services->getRepoGroup());}, 'TitleParser'=> static function(MediaWikiServices $services):TitleParser { return $services->getService( '_MediaWikiTitleCodec');}, 'TrackingCategories'=> static function(MediaWikiServices $services):TrackingCategories { return new TrackingCategories(new ServiceOptions(TrackingCategories::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getNamespaceInfo(), $services->getTitleParser(), LoggerFactory::getInstance( 'TrackingCategories'));}, 'UnblockUserFactory'=> static function(MediaWikiServices $services):UnblockUserFactory { return $services->getService( '_UserBlockCommandFactory');}, 'UndeletePageFactory'=> static function(MediaWikiServices $services):UndeletePageFactory { return $services->getService( '_PageCommandFactory');}, 'UploadRevisionImporter'=> static function(MediaWikiServices $services):UploadRevisionImporter { return new ImportableUploadRevisionImporter($services->getMainConfig() ->get(MainConfigNames::EnableUploads), LoggerFactory::getInstance( 'UploadRevisionImporter'));}, 'UrlUtils'=> static function(MediaWikiServices $services):UrlUtils { $config=$services->getMainConfig();return new UrlUtils([UrlUtils::SERVER=> $config->get(MainConfigNames::Server), UrlUtils::CANONICAL_SERVER=> $config->get(MainConfigNames::CanonicalServer), UrlUtils::INTERNAL_SERVER=> $config->get(MainConfigNames::InternalServer), UrlUtils::FALLBACK_PROTOCOL=> RequestContext::getMain() ->getRequest() ->getProtocol(), UrlUtils::HTTPS_PORT=> $config->get(MainConfigNames::HttpsPort), UrlUtils::VALID_PROTOCOLS=> $config->get(MainConfigNames::UrlProtocols),]);}, 'UserCache'=> static function(MediaWikiServices $services):UserCache { return new UserCache(LoggerFactory::getInstance( 'UserCache'), $services->getDBLoadBalancer(), $services->getLinkBatchFactory());}, 'UserEditTracker'=> static function(MediaWikiServices $services):UserEditTracker { return new UserEditTracker($services->getActorMigration(), $services->getDBLoadBalancer(), $services->getJobQueueGroup());}, 'UserFactory'=> static function(MediaWikiServices $services):UserFactory { return new UserFactory($services->getDBLoadBalancer(), $services->getUserNameUtils());}, 'UserGroupManager'=> static function(MediaWikiServices $services):UserGroupManager { return $services->getUserGroupManagerFactory() ->getUserGroupManager();}, 'UserGroupManagerFactory'=> static function(MediaWikiServices $services):UserGroupManagerFactory { return new UserGroupManagerFactory(new ServiceOptions(UserGroupManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getConfiguredReadOnlyMode(), $services->getDBLoadBalancerFactory(), $services->getHookContainer(), $services->getUserEditTracker(), $services->getGroupPermissionsLookup(), $services->getJobQueueGroupFactory(), LoggerFactory::getInstance( 'UserGroupManager'), $services->getTempUserConfig(), [static function(UserIdentity $user) use( $services) { $services->getPermissionManager() ->invalidateUsersRightsCache( $user);$services->getUserFactory() ->newFromUserIdentity( $user) ->invalidateCache();}]);}, 'UserIdentityLookup'=> static function(MediaWikiServices $services):UserIdentityLookup { return $services->getActorStoreFactory() ->getUserIdentityLookup();}, 'UserNamePrefixSearch'=> static function(MediaWikiServices $services):UserNamePrefixSearch { return new UserNamePrefixSearch($services->getDBLoadBalancer(), $services->getUserNameUtils());}, 'UserNameUtils'=> static function(MediaWikiServices $services):UserNameUtils { $messageFormatterFactory=new MessageFormatterFactory(Message::FORMAT_PLAIN);return new UserNameUtils(new ServiceOptions(UserNameUtils::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getContentLanguage(), LoggerFactory::getInstance( 'UserNameUtils'), $services->getTitleParser(), $messageFormatterFactory->getTextFormatter($services->getContentLanguage() ->getCode()), $services->getHookContainer(), $services->getTempUserConfig());}, 'UserOptionsLookup'=> static function(MediaWikiServices $services):UserOptionsLookup { return $services->getUserOptionsManager();}, 'UserOptionsManager'=> static function(MediaWikiServices $services):UserOptionsManager { return new UserOptionsManager(new ServiceOptions(UserOptionsManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->get( '_DefaultOptionsLookup'), $services->getLanguageConverterFactory(), $services->getDBLoadBalancer(), LoggerFactory::getInstance( 'UserOptionsManager'), $services->getHookContainer(), $services->getUserFactory());}, 'VirtualRESTServiceClient'=> static function(MediaWikiServices $services):VirtualRESTServiceClient { $config=$services->getMainConfig() ->get(MainConfigNames::VirtualRestConfig);$vrsClient=new VirtualRESTServiceClient($services->getHttpRequestFactory() ->createMultiClient());foreach( $config['paths'] as $prefix=> $serviceConfig) { $class=$serviceConfig['class'];$constructArg=$serviceConfig['options'] ??[];$constructArg+=$config['global'];$vrsClient->mount( $prefix, [ 'class'=> $class, 'config'=> $constructArg]);} return $vrsClient;}, 'WatchedItemQueryService'=> static function(MediaWikiServices $services):WatchedItemQueryService { return new WatchedItemQueryService($services->getDBLoadBalancer(), $services->getCommentStore(), $services->getWatchedItemStore(), $services->getHookContainer(), $services->getUserOptionsLookup(), $services->getMainConfig() ->get(MainConfigNames::WatchlistExpiry), $services->getMainConfig() ->get(MainConfigNames::MaxExecutionTimeForExpensiveQueries));}, 'WatchedItemStore'=> static function(MediaWikiServices $services):WatchedItemStore { $store=new WatchedItemStore(new ServiceOptions(WatchedItemStore::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getDBLoadBalancerFactory(), $services->getJobQueueGroup(), $services->getMainObjectStash(), new HashBagOStuff([ 'maxKeys'=> 100]), $services->getReadOnlyMode(), $services->getNamespaceInfo(), $services->getRevisionLookup(), $services->getLinkBatchFactory());$store->setStatsdDataFactory( $services->getStatsdDataFactory());if( $services->getMainConfig() ->get(MainConfigNames::ReadOnlyWatchedItemStore)) { $store=new NoWriteWatchedItemStore( $store);} return $store;}, 'WatchlistManager'=> static function(MediaWikiServices $services):WatchlistManager { return new WatchlistManager([WatchlistManager::OPTION_ENOTIF=> RecentChange::isEnotifEnabled( $services->getMainConfig()),], $services->getHookContainer(), $services->getReadOnlyMode(), $services->getRevisionLookup(), $services->getTalkPageNotificationManager(), $services->getWatchedItemStore(), $services->getUserFactory(), $services->getNamespaceInfo(), $services->getWikiPageFactory());}, 'WikiExporterFactory'=> static function(MediaWikiServices $services):WikiExporterFactory { return new WikiExporterFactory($services->getHookContainer(), $services->getRevisionStore(), $services->getTitleParser(), $services->getCommentStore());}, 'WikiImporterFactory'=> static function(MediaWikiServices $services):WikiImporterFactory { return new WikiImporterFactory($services->getMainConfig(), $services->getHookContainer(), $services->getContentLanguage(), $services->getNamespaceInfo(), $services->getTitleFactory(), $services->getWikiPageFactory(), $services->getWikiRevisionUploadImporter(), $services->getPermissionManager(), $services->getContentHandlerFactory(), $services->getSlotRoleRegistry());}, 'WikiPageFactory'=> static function(MediaWikiServices $services):WikiPageFactory { return new WikiPageFactory($services->getTitleFactory(), new HookRunner( $services->getHookContainer()), $services->getDBLoadBalancer());}, 'WikiRevisionOldRevisionImporterNoUpdates'=> static function(MediaWikiServices $services):ImportableOldRevisionImporter { return new ImportableOldRevisionImporter(false, LoggerFactory::getInstance( 'OldRevisionImporter'), $services->getDBLoadBalancer(), $services->getRevisionStore(), $services->getSlotRoleRegistry(), $services->getWikiPageFactory(), $services->getPageUpdaterFactory(), $services->getUserFactory());}, 'WRStatsFactory'=> static function(MediaWikiServices $services):WRStatsFactory { return new WRStatsFactory(new BagOStuffStatsStore(ObjectCache::getInstance( $services->getMainConfig() ->get(MainConfigNames::StatsCacheType))));}, '_DefaultOptionsLookup'=> static function(MediaWikiServices $services):DefaultOptionsLookup { return new DefaultOptionsLookup(new ServiceOptions(DefaultOptionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getContentLanguage(), $services->getHookContainer(), $services->getNamespaceInfo());}, '_EditConstraintFactory'=> static function(MediaWikiServices $services):EditConstraintFactory { return new EditConstraintFactory(new ServiceOptions(EditConstraintFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), LoggerFactory::getProvider(), $services->getPermissionManager(), $services->getHookContainer(), $services->getReadOnlyMode(), $services->getSpamChecker());}, '_LocalClusterCache'=> static function(MediaWikiServices $services):BagOStuff { $mainConfig=$services->getMainConfig();$id=$mainConfig->get(MainConfigNames::MainCacheType);$params=$mainConfig->get(MainConfigNames::ObjectCaches)[$id] ?? null;if(! $params) { throw new UnexpectedValueException("\$wgObjectCaches must have \"$id\" set (via \$wgMainCacheType)");} return ObjectCache::newFromParams( $params, $services);}, '_MediaWikiTitleCodec'=> static function(MediaWikiServices $services):MediaWikiTitleCodec { return new MediaWikiTitleCodec($services->getContentLanguage(), $services->getGenderCache(), $services->getMainConfig() ->get(MainConfigNames::LocalInterwikis), $services->getInterwikiLookup(), $services->getNamespaceInfo());}, '_PageCommandFactory'=> static function(MediaWikiServices $services):PageCommandFactory { return new PageCommandFactory($services->getMainConfig(), $services->getDBLoadBalancerFactory(), $services->getNamespaceInfo(), $services->getWatchedItemStore(), $services->getRepoGroup(), $services->getReadOnlyMode(), $services->getContentHandlerFactory(), $services->getRevisionStore(), $services->getSpamChecker(), $services->getTitleFormatter(), $services->getHookContainer(), $services->getWikiPageFactory(), $services->getUserFactory(), $services->getActorMigration(), $services->getActorNormalization(), $services->getTitleFactory(), $services->getUserEditTracker(), $services->getCollationFactory(), $services->getJobQueueGroup(), $services->getCommentStore(), $services->getMainObjectStash(), WikiMap::getCurrentWikiDbDomain() ->getId(), WebRequest::getRequestId(), $services->getBacklinkCacheFactory(), LoggerFactory::getInstance( 'UndeletePage'), $services->getPageUpdaterFactory(), $services->getMessageFormatterFactory() ->getTextFormatter($services->getContentLanguage() ->getCode()), $services->getArchivedRevisionLookup(), $services->getRestrictionStore());}, '_ParserObserver'=> static function(MediaWikiServices $services):ParserObserver { return new ParserObserver(LoggerFactory::getInstance( 'DuplicateParse'));}, '_Parsoid'=> static function(MediaWikiServices $services):Parsoid { return new Parsoid($services->getParsoidSiteConfig(), $services->getParsoidDataAccess());}, '_SettingsBuilder'=> static function(MediaWikiServices $services):SettingsBuilder { return SettingsBuilder::getInstance();}, '_SqlBlobStore'=> static function(MediaWikiServices $services):SqlBlobStore { return $services->getBlobStoreFactory() ->newSqlBlobStore();}, '_UserBlockCommandFactory'=> static function(MediaWikiServices $services):UserBlockCommandFactory { return new UserBlockCommandFactory(new ServiceOptions(UserBlockCommandFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getHookContainer(), $services->getBlockPermissionCheckerFactory(), $services->getBlockUtils(), $services->getDatabaseBlockStore(), $services->getBlockRestrictionStore(), $services->getUserFactory(), $services->getUserEditTracker(), LoggerFactory::getInstance( 'BlockManager'), $services->getTitleFactory(), $services->getBlockActionInfo());},]
@phpcs-require-sorted-array
Class representing a cache/ephemeral data store.
Definition BagOStuff.php:85
get( $key, $flags=0)
Get an item.
MediaWiki adaption of StatsdDataFactory that provides buffering and metric prefixing.
Hold a configured list of sites (SiteList), with a caching layer.
The CentralIdLookup service allows for connecting local users with cluster-wide IDs.
static getSoftwareTags( $all=false)
Loads defined core tags, checks for invalid types (if not array), and filters for supported and enabl...
Factory class to create Config objects.
A read-only mode service which does not depend on LoadBalancer.
Holds a list of sites stored in the database.
Support for detecting/validating DjVu image files and getting some basic file metadata (resolution et...
Definition DjVuImage.php:41
A BagOStuff object with no objects in it.
Factory class for spawning EventRelayer objects using configuration.
The Registry loads JSON files, and uses a Processor to extract information from them.
This is the main interface for fetching or inserting objects with ExternalStore.
Class to handle file backend registration.
Caches user genders when needed to use correct namespace aliases.
Simple store for keeping values in an associative array for the current process.
Hooks class.
Definition Hooks.php:38
Class to invalidate the CDN and HTMLFileCache entries associated with URLs/titles.
Handle enqueueing of background jobs.
Job queue runner utility methods.
Definition JobRunner.php:40
Methods for dealing with language codes.
Base class for language-specific code.
Definition Language.php:56
Cache for article titles (prefixed DB keys) and ids linked from one source.
Definition LinkCache.php:42
Caching for the contents of localisation files.
static getStoreFromConf(array $conf, $fallbackCacheDir)
Return a suitable LCStore as specified by the given configuration.
MediaWiki-specific class for generating database load balancers.
Class to construct MediaHandler objects.
A codec for MediaWiki page titles.
This serves as the entry point to the authentication system.
setLogger(LoggerInterface $logger)
Defines the actions that can be blocked by a partial block.
A service class for getting formatted information about a block.
A service class for checking blocks.
Backend class for blocking utils.
A DatabaseBlock (unlike a SystemBlock) is stored in the database, may give rise to autoblocks and may...
This class performs some operations related to tracking categories, such as creating a list of all su...
Common factory to construct collation classes.
This is the main service interface for converting single-line comments from various DB comment fields...
This is basically a CommentFormatter with a CommentStore dependency, allowing it to retrieve comment ...
Handle database storage of comments such as edit summaries and log reasons.
Object which holds currently registered configuration options.
A class for passing options to services.
Constraints reflect possible errors that need to be checked.
Service to check if text (either content or a summary) qualifies as spam.
Factory service for WikiExporter instances.
This class provides an implementation of the core hook interfaces, forwarding hook calls to HookConta...
This is a simple immutable HookRegistry which can be used to set up a local HookContainer in tests an...
Factory creating MWHttpRequest objects.
InterwikiLookup backed by the interwiki database table or $wgInterwikiCache.
Class to construct JobQueueGroups.
An interface for creating language converters.
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
A service that provides utilities to do with language names and codes.
Factory to create LinkRender objects.
Class that generates HTML for internal links.
Service for retrieving and storing link targets.
Service for compat reading of links tables.
PSR-3 logger instance factory.
A class containing constants representing the names of configuration variables.
Service locator for MediaWiki core services.
The MediaWiki-specific implementation of IMessageFormatterFactory.
Implementation of various page action services.
Gives access to properties of a page.
Definition PageProps.php:36
Service for getting rendered output of a given page.
Service for storing and retreiving page redirect information.
Service for creating WikiPage objects.
A factory that stores information about MagicWords, and creates them on demand with caching.
Implement Parsoid's abstract class for data access.
Helper class used by MediaWiki to create Parsoid PageConfig objects.
Site-level configuration for Parsoid.
MediaWiki service for getting Parsoid Output objects.
Users can authorize applications to use their account via OAuth.
This separate service is needed because the ::getGrantsLink method requires a LinkRenderer and if we ...
A service class for checking permissions To obtain an instance, use MediaWikiServices::getInstance()-...
Provides rate limiting for a set of actions based on several counter buckets.
This is the default implementation of PreferencesFactory.
This class generates message blobs for use by ResourceLoader.
ResourceLoader is a loading system for JavaScript and CSS resources.
A SlotRoleHandler for the main slot.
The RevisionRenderer service provides access to rendered output for revisions.
setLogger(LoggerInterface $saveParseLogger)
Factory service for RevisionStore instances.
Service for looking up page revisions.
Value object representing a content slot associated with a page revision.
A registry service for SlotRoleHandlers, used to define which slot roles are available on which page.
defineRole( $role, callable $instantiator)
Defines a slot role.
Service implementation of near match title search.
Builder class for constructing a Config object from a set of sources during bootstrap.
Factory facilitating dependency injection for Command.
This is a service which provides a configured client to access a remote Shellbox installation.
Factory for handling the special page list and generating SpecialPage objects.
Service for instantiating BlobStores.
Class allowing easy storage and retrieval of EditResults associated with revisions.
Manage the pre-emptive page parsing for edits to wiki pages.
A factory for PageUpdater and DerivedPageDataUpdater instances.
Class for managing delayed RevertedTagUpdateJob waiting for user approval.
Service for storing and loading Content objects representing revision data blobs.
Base class for HTML cleanup utilities.
Creates Title objects.
This is not intended to be a long-term part of MediaWiki; it will be deprecated and removed once acto...
A service class to control default user options.
The real TempUserConfig including internal methods used by TempUserCreator.
Service for temporary user creation.
Track info about user edit counts and timings.
Creates User objects.
Factory service for UserGroupManager instances.
Handles searching prefixes of user names.
UserNameUtils service.
Provides access to user options.
A service class to control user options.
A service to expand, parse, and otherwise manipulate URLs.
Definition UrlUtils.php:17
Helper tools for dealing with other locally-hosted wikis.
Definition WikiMap.php:33
Cache messages that are defined by MediaWiki-namespace pages or by hooks.
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition Message.php:144
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Functions to get cache objects.
static newFromParams(array $params, MediaWikiServices $services=null)
Create a new cache object from parameters.
static getInstance( $id)
Get a cached instance of the specified type of cache object.
static getLocalClusterInstance()
Get the main cluster-local cache object.
Cache for ParserOutput objects corresponding to the latest page revisions.
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
Definition Parser.php:107
Factory class for creating and checking Password objects.
Helper class for the password reset functionality shared by the web UI and the API.
Proxy to prefix metric keys sent to a StatsdDataFactoryInterface.
A service class for fetching the wiki's current read-only mode.
Utility class for creating new RC entries.
Prioritized list of file repositories.
Definition RepoGroup.php:30
Group all the pieces relevant to the context of a request into one instance.
Configuration handling class for SearchEngine.
Factory class for SearchEngine.
Factory class to create Skin objects.
register( $name, $displayName, $spec, bool $skippable=null)
Register a new skin.
Virtual HTTP service client loosely styled after a Virtual File System.
Multi-datacenter aware caching interface.
get( $key, &$curTTL=null, array $checkKeys=[], &$info=[])
Fetch the value of a key from cache.
static newEmpty()
Get an instance that wraps EmptyBagOStuff.
Storage layer class for WatchedItems.
setStatsdDataFactory(StatsdDataFactoryInterface $stats)
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
Factory service for WikiImporter instances.
Track per-module file dependencies in object cache via BagOStuff.
Track per-module file dependencies in the core module_deps table.
Constructs Database objects.
Singleton cache for Metric instances.
StatsFactory Implementation.
Class for getting statistically unique IDs without a central coordinator.
An adaptor allowing WRStats to store data in MediaWiki's BagOStuff.
A factory for WRStats readers and writers.
Interface for configuration instances.
Definition Config.php:30
MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.
Marker interface for entities aware of the wiki they belong to.
Stash for Parsoid output and associated data as needed to perform selective serialization (aka "selse...
Service interface for looking up Interwiki records.
Interface for sending emails.
Definition IEmailer.php:34
Service for changing the content model of wiki pages.
Service for page delete actions.
Service for mergehistory actions.
Service for page rename actions.
Service for resolving a wiki page redirect.
Service for page rollback actions.
Service for page undelete actions.
A PreferencesFactory is a MediaWiki service that provides the definitions of preferences for a given ...
Service for constructing RevisionRecord objects.
Service for looking up page revisions.
Represents a config schema.
Service for loading and storing data blobs.
Definition BlobStore.php:33
Service for dealing with the actor table.
Interface for objects representing user identity.
Interface to retreive Site objects, for implementation by service classes.
Interface for storing and retreiving Site objects.
Definition SiteStore.php:30
A title formatter service for MediaWiki.
A title parser service for MediaWiki.
A simple factory providing a message formatter for a given language code.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
return true
Definition router.php:92
$mime
Definition router.php:60
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition router.php:42
if(!is_readable( $file)) $ext
Definition router.php:48