MediaWiki  master
ServiceWiring.php
Go to the documentation of this file.
1 <?php
47 use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
148 use Wikimedia\ObjectFactory;
149 use Wikimedia\RequestTimeout\CriticalSectionProvider;
150 use Wikimedia\RequestTimeout\RequestTimeout;
151 use Wikimedia\Services\RecursiveServiceDependencyException;
153 
155 return [
156  'ActionFactory' => static function ( MediaWikiServices $services ): ActionFactory {
157  return new ActionFactory(
158  $services->getMainConfig()->get( 'Actions' ),
159  LoggerFactory::getInstance( 'ActionFactory' ),
160  $services->getObjectFactory(),
161  $services->getHookContainer()
162  );
163  },
164 
165  'ActorMigration' => static function ( MediaWikiServices $services ): ActorMigration {
166  return new ActorMigration(
167  $services->getMainConfig()->get( 'ActorTableSchemaMigrationStage' ),
168  $services->getActorStoreFactory()
169  );
170  },
171 
172  'ActorNormalization' => static function ( MediaWikiServices $services ): ActorNormalization {
173  return $services->getActorStoreFactory()->getActorNormalization();
174  },
175 
176  'ActorStore' => static function ( MediaWikiServices $services ): ActorStore {
177  return $services->getActorStoreFactory()->getActorStore();
178  },
179 
180  'ActorStoreFactory' => static function ( MediaWikiServices $services ): ActorStoreFactory {
181  return new ActorStoreFactory(
182  new ServiceOptions( ActorStoreFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
183  $services->getDBLoadBalancerFactory(),
184  $services->getUserNameUtils(),
185  LoggerFactory::getInstance( 'ActorStore' )
186  );
187  },
188 
189  'AuthManager' => static function ( MediaWikiServices $services ): AuthManager {
190  $authManager = new AuthManager(
191  RequestContext::getMain()->getRequest(),
192  $services->getMainConfig(),
193  $services->getObjectFactory(),
194  $services->getHookContainer(),
195  $services->getReadOnlyMode(),
196  $services->getUserNameUtils(),
197  $services->getBlockManager(),
198  $services->getWatchlistManager(),
199  $services->getDBLoadBalancer(),
200  $services->getContentLanguage(),
201  $services->getLanguageConverterFactory()
202  );
203  $authManager->setLogger( LoggerFactory::getInstance( 'authentication' ) );
204  return $authManager;
205  },
206 
207  'BadFileLookup' => static function ( MediaWikiServices $services ): BadFileLookup {
208  return new BadFileLookup(
209  static function () {
210  return wfMessage( 'bad_image_list' )->inContentLanguage()->plain();
211  },
212  $services->getLocalServerObjectCache(),
213  $services->getRepoGroup(),
214  $services->getTitleParser(),
215  $services->getHookContainer()
216  );
217  },
218 
219  'BlobStore' => static function ( MediaWikiServices $services ): BlobStore {
220  return $services->getService( '_SqlBlobStore' );
221  },
222 
223  'BlobStoreFactory' => static function ( MediaWikiServices $services ): BlobStoreFactory {
224  return new BlobStoreFactory(
225  $services->getDBLoadBalancerFactory(),
226  $services->getExternalStoreAccess(),
227  $services->getMainWANObjectCache(),
228  new ServiceOptions( BlobStoreFactory::CONSTRUCTOR_OPTIONS,
229  $services->getMainConfig() )
230  );
231  },
232 
233  'BlockActionInfo' => static function ( MediaWikiServices $services ): BlockActionInfo {
234  return new BlockActionInfo( $services->getHookContainer() );
235  },
236 
237  'BlockErrorFormatter' => static function ( MediaWikiServices $services ): BlockErrorFormatter {
238  return new BlockErrorFormatter(
239  $services->getTitleFormatter()
240  );
241  },
242 
243  'BlockManager' => static function ( MediaWikiServices $services ): BlockManager {
244  return new BlockManager(
245  new ServiceOptions(
246  BlockManager::CONSTRUCTOR_OPTIONS,
247  $services->getMainConfig()
248  ),
249  $services->getPermissionManager(),
250  $services->getUserFactory(),
251  LoggerFactory::getInstance( 'BlockManager' ),
252  $services->getHookContainer()
253  );
254  },
255 
256  'BlockPermissionCheckerFactory' => static function (
257  MediaWikiServices $services
260  new ServiceOptions(
261  BlockPermissionCheckerFactory::CONSTRUCTOR_OPTIONS,
262  $services->getMainConfig()
263  ),
264  $services->getBlockUtils()
265  );
266  },
267 
268  'BlockRestrictionStore' => static function ( MediaWikiServices $services ): BlockRestrictionStore {
269  return new BlockRestrictionStore(
270  $services->getDBLoadBalancer()
271  );
272  },
273 
274  'BlockUserFactory' => static function ( MediaWikiServices $services ): BlockUserFactory {
275  return $services->getService( '_UserBlockCommandFactory' );
276  },
277 
278  'BlockUtils' => static function ( MediaWikiServices $services ): BlockUtils {
279  return new BlockUtils(
280  new ServiceOptions(
281  BlockUtils::CONSTRUCTOR_OPTIONS,
282  $services->getMainConfig()
283  ),
284  $services->getUserIdentityLookup(),
285  $services->getUserNameUtils()
286  );
287  },
288 
289  'BotPasswordStore' => static function ( MediaWikiServices $services ): BotPasswordStore {
290  return new BotPasswordStore(
291  new ServiceOptions(
292  BotPasswordStore::CONSTRUCTOR_OPTIONS,
293  $services->getMainConfig()
294  ),
295  $services->getCentralIdLookup(),
296  $services->getDBLoadBalancerFactory()
297  );
298  },
299 
300  'CentralIdLookup' => static function ( MediaWikiServices $services ): CentralIdLookup {
301  return $services->getCentralIdLookupFactory()->getLookup();
302  },
303 
304  'CentralIdLookupFactory' => static function ( MediaWikiServices $services ): CentralIdLookupFactory {
305  return new CentralIdLookupFactory(
306  new ServiceOptions( CentralIdLookupFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
307  $services->getObjectFactory(),
308  $services->getUserIdentityLookup()
309  );
310  },
311 
312  'ChangeTagDefStore' => static function ( MediaWikiServices $services ): NameTableStore {
313  return $services->getNameTableStoreFactory()->getChangeTagDef();
314  },
315 
316  'CommentStore' => static function ( MediaWikiServices $services ): CommentStore {
317  return new CommentStore(
318  $services->getContentLanguage(),
320  );
321  },
322 
323  'ConfigFactory' => static function ( MediaWikiServices $services ): ConfigFactory {
324  // Use the bootstrap config to initialize the ConfigFactory.
325  $registry = $services->getBootstrapConfig()->get( 'ConfigRegistry' );
326  $factory = new ConfigFactory();
327 
328  foreach ( $registry as $name => $callback ) {
329  $factory->register( $name, $callback );
330  }
331  return $factory;
332  },
333 
334  'ConfigRepository' => static function ( MediaWikiServices $services ): ConfigRepository {
335  return new ConfigRepository( $services->getConfigFactory() );
336  },
337 
338  'ConfiguredReadOnlyMode' => static function ( MediaWikiServices $services ): ConfiguredReadOnlyMode {
339  $config = $services->getMainConfig();
340  return new ConfiguredReadOnlyMode(
341  $config->get( 'ReadOnly' ),
342  $config->get( 'ReadOnlyFile' )
343  );
344  },
345 
346  'ContentHandlerFactory' => static function ( MediaWikiServices $services ): IContentHandlerFactory {
347  $contentHandlerConfig = $services->getMainConfig()->get( 'ContentHandlers' );
348 
349  return new ContentHandlerFactory(
350  $contentHandlerConfig,
351  $services->getObjectFactory(),
352  $services->getHookContainer(),
353  LoggerFactory::getInstance( 'ContentHandler' )
354  );
355  },
356 
357  'ContentLanguage' => static function ( MediaWikiServices $services ): Language {
358  return $services->getLanguageFactory()->getLanguage(
359  $services->getMainConfig()->get( 'LanguageCode' ) );
360  },
361 
362  'ContentModelChangeFactory' => static function ( MediaWikiServices $services ): ContentModelChangeFactory {
363  return $services->getService( '_PageCommandFactory' );
364  },
365 
366  'ContentModelStore' => static function ( MediaWikiServices $services ): NameTableStore {
367  return $services->getNameTableStoreFactory()->getContentModels();
368  },
369 
370  'ContentTransformer' => static function ( MediaWikiServices $services ): ContentTransformer {
371  return new ContentTransformer( $services->getContentHandlerFactory() );
372  },
373 
374  'ContributionsLookup' => static function ( MediaWikiServices $services ): ContributionsLookup {
375  return new ContributionsLookup(
376  $services->getRevisionStore(),
377  $services->getLinkRenderer(),
378  $services->getLinkBatchFactory(),
379  $services->getHookContainer(),
380  $services->getDBLoadBalancer(),
381  $services->getActorMigration(),
382  $services->getNamespaceInfo()
383  );
384  },
385 
386  'CriticalSectionProvider' => static function ( MediaWikiServices $services ): CriticalSectionProvider {
387  $config = $services->getMainConfig();
388  $limit = $config->get( 'CommandLineMode' ) ? INF : $config->get( 'CriticalSectionTimeLimit' );
389  return RequestTimeout::singleton()->createCriticalSectionProvider( $limit );
390  },
391 
392  'CryptHKDF' => static function ( MediaWikiServices $services ): CryptHKDF {
393  $config = $services->getMainConfig();
394 
395  $secret = $config->get( 'HKDFSecret' ) ?: $config->get( 'SecretKey' );
396  if ( !$secret ) {
397  throw new RuntimeException( "Cannot use MWCryptHKDF without a secret." );
398  }
399 
400  // In HKDF, the context can be known to the attacker, but this will
401  // keep simultaneous runs from producing the same output.
402  $context = [ microtime(), getmypid(), gethostname() ];
403 
404  // Setup salt cache. Use APC, or fallback to the main cache if it isn't setup
405  $cache = $services->getLocalServerObjectCache();
406  if ( $cache instanceof EmptyBagOStuff ) {
408  }
409 
410  return new CryptHKDF( $secret, $config->get( 'HKDFAlgorithm' ), $cache, $context );
411  },
412 
413  'DatabaseBlockStore' => static function ( MediaWikiServices $services ): DatabaseBlockStore {
414  return new DatabaseBlockStore(
415  new ServiceOptions(
416  DatabaseBlockStore::CONSTRUCTOR_OPTIONS,
417  $services->getMainConfig()
418  ),
419  LoggerFactory::getInstance( 'DatabaseBlockStore' ),
420  $services->getActorStoreFactory(),
421  $services->getBlockRestrictionStore(),
422  $services->getCommentStore(),
423  $services->getHookContainer(),
424  $services->getDBLoadBalancer(),
425  $services->getReadOnlyMode(),
426  $services->getUserFactory()
427  );
428  },
429 
430  'DateFormatterFactory' => static function ( MediaWikiServices $services ): DateFormatterFactory {
431  return new DateFormatterFactory();
432  },
433 
434  'DBLoadBalancer' => static function ( MediaWikiServices $services ): Wikimedia\Rdbms\ILoadBalancer {
435  // just return the default LB from the DBLoadBalancerFactory service
436  return $services->getDBLoadBalancerFactory()->getMainLB();
437  },
438 
439  'DBLoadBalancerFactory' =>
440  static function ( MediaWikiServices $services ): Wikimedia\Rdbms\LBFactory {
441  $mainConfig = $services->getMainConfig();
442 
443  $cpStashType = $mainConfig->get( 'ChronologyProtectorStash' );
444  if ( is_string( $cpStashType ) ) {
445  $cpStash = ObjectCache::getInstance( $cpStashType );
446  } else {
447  try {
449  } catch ( RecursiveServiceDependencyException $e ) {
450  $cpStash = new EmptyBagOStuff(); // T141804: handle cases like CACHE_DB
451  }
452  }
453  LoggerFactory::getInstance( 'DBReplication' )->debug(
454  'ChronologyProtector using store {class}',
455  [ 'class' => get_class( $cpStash ) ]
456  );
457 
458  try {
459  $wanCache = $services->getMainWANObjectCache();
460  } catch ( RecursiveServiceDependencyException $e ) {
461  $wanCache = WANObjectCache::newEmpty(); // T141804: handle cases like CACHE_DB
462  }
463 
464  $srvCache = $services->getLocalServerObjectCache();
465  if ( $srvCache instanceof EmptyBagOStuff ) {
466  // Use process cache if no APCU or other local-server cache (e.g. on CLI)
467  $srvCache = new HashBagOStuff( [ 'maxKeys' => 100 ] );
468  }
469 
471  $mainConfig->get( 'LBFactoryConf' ),
473  $services->getConfiguredReadOnlyMode(),
474  $cpStash,
475  $srvCache,
476  $wanCache,
477  $services->getCriticalSectionProvider()
478  );
479 
480  $class = MWLBFactory::getLBFactoryClass( $lbConf );
481  $instance = new $class( $lbConf );
482 
483  MWLBFactory::setDomainAliases( $instance );
484 
485  // NOTE: This accesses ProxyLookup from the MediaWikiServices singleton
486  // for non-essential non-nonimal purposes (via WebRequest::getIP).
487  // This state is fine (and meant) to be consistent for a given PHP process,
488  // even if applied to the service container for a different wiki.
490  $instance,
491  $mainConfig,
492  $services->getStatsdDataFactory()
493  );
494 
495  return $instance;
496  },
497 
498  'Emailer' => static function ( MediaWikiServices $services ): IEmailer {
499  return new Emailer();
500  },
501 
502  'EventRelayerGroup' => static function ( MediaWikiServices $services ): EventRelayerGroup {
503  return new EventRelayerGroup( $services->getMainConfig()->get( 'EventRelayerConfig' ) );
504  },
505 
506  'ExternalStoreAccess' => static function ( MediaWikiServices $services ): ExternalStoreAccess {
507  return new ExternalStoreAccess(
508  $services->getExternalStoreFactory(),
509  LoggerFactory::getInstance( 'ExternalStore' )
510  );
511  },
512 
513  'ExternalStoreFactory' => static function ( MediaWikiServices $services ): ExternalStoreFactory {
514  $config = $services->getMainConfig();
515  $writeStores = $config->get( 'DefaultExternalStore' );
516 
517  return new ExternalStoreFactory(
518  $config->get( 'ExternalStores' ),
519  ( $writeStores !== false ) ? (array)$writeStores : [],
520  $services->getDBLoadBalancer()->getLocalDomainID(),
521  LoggerFactory::getInstance( 'ExternalStore' )
522  );
523  },
524 
525  'FileBackendGroup' => static function ( MediaWikiServices $services ): FileBackendGroup {
526  $mainConfig = $services->getMainConfig();
527 
529  $fallbackWikiId = WikiMap::getWikiIdFromDbDomain( $ld );
530  // If the local wiki ID and local domain ID do not match, probably due to a non-default
531  // schema, issue a warning. A non-default schema indicates that it might be used to
532  // disambiguate different wikis.
533  $legacyDomainId = strlen( $ld->getTablePrefix() )
534  ? "{$ld->getDatabase()}-{$ld->getTablePrefix()}"
535  : $ld->getDatabase();
536  if ( $ld->getSchema() !== null && $legacyDomainId !== $fallbackWikiId ) {
537  wfWarn(
538  "Legacy default 'domainId' is '$legacyDomainId' but wiki ID is '$fallbackWikiId'."
539  );
540  }
541 
542  $cache = $services->getLocalServerObjectCache();
543  if ( $cache instanceof EmptyBagOStuff ) {
544  $cache = new HashBagOStuff();
545  }
546 
547  return new FileBackendGroup(
549  [ 'fallbackWikiId' => $fallbackWikiId ] ),
550  $services->getConfiguredReadOnlyMode(),
551  $cache,
552  $services->getMainWANObjectCache(),
553  $services->getMimeAnalyzer(),
554  $services->getLockManagerGroupFactory(),
555  $services->getTempFSFileFactory(),
556  $services->getObjectFactory()
557  );
558  },
559 
560  'GenderCache' => static function ( MediaWikiServices $services ): GenderCache {
561  $nsInfo = $services->getNamespaceInfo();
562  // Database layer may be disabled, so processing without database connection
563  $dbLoadBalancer = $services->isServiceDisabled( 'DBLoadBalancer' )
564  ? null
565  : $services->getDBLoadBalancer();
566  return new GenderCache( $nsInfo, $dbLoadBalancer, $services->get( '_DefaultOptionsLookup' ) );
567  },
568 
569  'GlobalIdGenerator' => static function ( MediaWikiServices $services ): GlobalIdGenerator {
570  $mainConfig = $services->getMainConfig();
571 
572  return new GlobalIdGenerator(
573  $mainConfig->get( 'TmpDirectory' ),
574  static function ( $command ) {
575  return wfShellExec( $command );
576  }
577  );
578  },
579 
580  'GroupPermissionsLookup' => static function ( MediaWikiServices $services ): GroupPermissionsLookup {
581  return new GroupPermissionsLookup(
582  new ServiceOptions( GroupPermissionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig() )
583  );
584  },
585 
586  'HookContainer' => static function ( MediaWikiServices $services ): HookContainer {
587  $extRegistry = ExtensionRegistry::getInstance();
588  $extDeprecatedHooks = $extRegistry->getAttribute( 'DeprecatedHooks' );
589  $deprecatedHooks = new DeprecatedHooks( $extDeprecatedHooks );
590  $hookRegistry = new GlobalHookRegistry( $extRegistry, $deprecatedHooks );
591  return new HookContainer(
592  $hookRegistry,
593  $services->getObjectFactory()
594  );
595  },
596 
597  'HtmlCacheUpdater' => static function ( MediaWikiServices $services ): HtmlCacheUpdater {
598  $config = $services->getMainConfig();
599 
600  return new HtmlCacheUpdater(
601  $services->getHookContainer(),
602  $services->getTitleFactory(),
603  $config->get( 'CdnReboundPurgeDelay' ),
604  $config->get( 'UseFileCache' ),
605  $config->get( 'CdnMaxAge' )
606  );
607  },
608 
609  'HttpRequestFactory' =>
610  static function ( MediaWikiServices $services ): HttpRequestFactory {
611  return new HttpRequestFactory(
612  new ServiceOptions(
613  HttpRequestFactory::CONSTRUCTOR_OPTIONS,
614  $services->getMainConfig()
615  ),
616  LoggerFactory::getInstance( 'http' )
617  );
618  },
619 
620  'InterwikiLookup' => static function ( MediaWikiServices $services ): InterwikiLookup {
621  $config = $services->getMainConfig();
622  return new ClassicInterwikiLookup(
623  $services->getContentLanguage(),
624  $services->getMainWANObjectCache(),
625  $services->getHookContainer(),
626  $services->getDBLoadBalancer(),
627  $config->get( 'InterwikiExpiry' ),
628  $config->get( 'InterwikiCache' ),
629  $config->get( 'InterwikiScopes' ),
630  $config->get( 'InterwikiFallbackSite' )
631  );
632  },
633 
634  'JobQueueGroup' => static function ( MediaWikiServices $services ): JobQueueGroup {
635  return $services->getJobQueueGroupFactory()->makeJobQueueGroup();
636  },
637 
638  'JobQueueGroupFactory' => static function ( MediaWikiServices $services ): JobQueueGroupFactory {
639  return new JobQueueGroupFactory(
640  new ServiceOptions( JobQueueGroupFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
641  $services->getConfiguredReadOnlyMode(),
642  $services->getStatsdDataFactory(),
643  $services->getMainWANObjectCache(),
644  $services->getGlobalIdGenerator()
645  );
646  },
647 
648  'JobRunner' => static function ( MediaWikiServices $services ): JobRunner {
649  return new JobRunner(
650  new ServiceOptions( JobRunner::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
651  $services->getDBLoadBalancerFactory(),
652  $services->getJobQueueGroup(),
653  $services->getReadOnlyMode(),
654  $services->getLinkCache(),
655  $services->getStatsdDataFactory(),
656  LoggerFactory::getInstance( 'runJobs' )
657  );
658  },
659 
660  'JsonCodec' => static function ( MediaWikiServices $services ): JsonCodec {
661  return new JsonCodec();
662  },
663 
664  'LanguageConverterFactory' => static function ( MediaWikiServices $services ): LanguageConverterFactory {
665  $usePigLatinVariant = $services->getMainConfig()->get( 'UsePigLatinVariant' );
666  $isConversionDisabled = $services->getMainConfig()->get( 'DisableLangConversion' );
667  $isTitleConversionDisabled = $services->getMainConfig()->get( 'DisableTitleConversion' );
668  return new LanguageConverterFactory(
669  $usePigLatinVariant,
670  $isConversionDisabled,
671  $isTitleConversionDisabled,
672  static function () use ( $services ) {
673  return $services->getContentLanguage();
674  }
675  );
676  },
677 
678  'LanguageFactory' => static function ( MediaWikiServices $services ): LanguageFactory {
679  return new LanguageFactory(
680  new ServiceOptions( LanguageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
681  $services->getLocalisationCache(),
682  $services->getLanguageNameUtils(),
683  $services->getLanguageFallback(),
684  $services->getLanguageConverterFactory(),
685  $services->getHookContainer()
686  );
687  },
688 
689  'LanguageFallback' => static function ( MediaWikiServices $services ): LanguageFallback {
690  return new LanguageFallback(
691  $services->getMainConfig()->get( 'LanguageCode' ),
692  $services->getLocalisationCache(),
693  $services->getLanguageNameUtils()
694  );
695  },
696 
697  'LanguageNameUtils' => static function ( MediaWikiServices $services ): LanguageNameUtils {
698  return new LanguageNameUtils(
699  new ServiceOptions(
700  LanguageNameUtils::CONSTRUCTOR_OPTIONS,
701  $services->getMainConfig()
702  ),
703  $services->getHookContainer()
704  );
705  },
706 
707  'LinkBatchFactory' => static function ( MediaWikiServices $services ): LinkBatchFactory {
708  return new LinkBatchFactory(
709  $services->getLinkCache(),
710  $services->getTitleFormatter(),
711  $services->getContentLanguage(),
712  $services->getGenderCache(),
713  $services->getDBLoadBalancer()
714  );
715  },
716 
717  'LinkCache' => static function ( MediaWikiServices $services ): LinkCache {
718  // Database layer may be disabled, so processing without database connection
719  $dbLoadBalancer = $services->isServiceDisabled( 'DBLoadBalancer' )
720  ? null
721  : $services->getDBLoadBalancer();
722  $linkCache = new LinkCache(
723  $services->getTitleFormatter(),
724  $services->getMainWANObjectCache(),
725  $services->getNamespaceInfo(),
726  $dbLoadBalancer
727  );
728  $linkCache->setLogger( LoggerFactory::getInstance( 'LinkCache' ) );
729  return $linkCache;
730  },
731 
732  'LinkRenderer' => static function ( MediaWikiServices $services ): LinkRenderer {
733  if ( defined( 'MW_NO_SESSION' ) ) {
734  return $services->getLinkRendererFactory()->create();
735  } else {
736  // Normally information from the current request would not be passed in here;
737  // this is an exception. (See also the class documentation.)
738  return $services->getLinkRendererFactory()->createForUser(
739  RequestContext::getMain()->getUser()
740  );
741  }
742  },
743 
744  'LinkRendererFactory' => static function ( MediaWikiServices $services ): LinkRendererFactory {
745  return new LinkRendererFactory(
746  $services->getTitleFormatter(),
747  $services->getLinkCache(),
748  $services->getNamespaceInfo(),
749  $services->getSpecialPageFactory(),
750  $services->getHookContainer()
751  );
752  },
753 
754  'LocalisationCache' => static function ( MediaWikiServices $services ): LocalisationCache {
755  $conf = $services->getMainConfig()->get( 'LocalisationCacheConf' );
756 
757  $logger = LoggerFactory::getInstance( 'localisation' );
758 
760  $conf, $services->getMainConfig()->get( 'CacheDirectory' ) );
761  $logger->debug( 'LocalisationCache using store ' . get_class( $store ) );
762 
763  return new $conf['class'](
764  new ServiceOptions(
766  // Two of the options are stored in $wgLocalisationCacheConf
767  $conf,
768  // In case someone set that config variable and didn't reset all keys, set defaults.
769  [
770  'forceRecache' => false,
771  'manualRecache' => false,
772  ],
773  // Some other options come from config itself
774  $services->getMainConfig()
775  ),
776  $store,
777  $logger,
778  [ static function () use ( $services ) {
779  // NOTE: Make sure we use the same cache object that is assigned in the
780  // constructor of the MessageBlobStore class used by ResourceLoader.
781  // T231866: Avoid circular dependency via ResourceLoader.
782  MessageBlobStore::clearGlobalCacheEntry( $services->getMainWANObjectCache() );
783  } ],
784  $services->getLanguageNameUtils(),
785  $services->getHookContainer()
786  );
787  },
788 
789  'LocalServerObjectCache' => static function ( MediaWikiServices $services ): BagOStuff {
791  },
792 
793  'LockManagerGroupFactory' => static function ( MediaWikiServices $services ): LockManagerGroupFactory {
794  return new LockManagerGroupFactory(
796  $services->getMainConfig()->get( 'LockManagers' ),
797  $services->getDBLoadBalancerFactory()
798  );
799  },
800 
801  'MagicWordFactory' => static function ( MediaWikiServices $services ): MagicWordFactory {
802  return new MagicWordFactory(
803  $services->getContentLanguage(),
804  $services->getHookContainer()
805  );
806  },
807 
808  'MainConfig' => static function ( MediaWikiServices $services ): Config {
809  // Use the 'main' config from the ConfigFactory service.
810  return $services->getConfigFactory()->makeConfig( 'main' );
811  },
812 
813  'MainObjectStash' => static function ( MediaWikiServices $services ): BagOStuff {
814  $mainConfig = $services->getMainConfig();
815 
816  $id = $mainConfig->get( 'MainStash' );
817  if ( !isset( $mainConfig->get( 'ObjectCaches' )[$id] ) ) {
818  throw new UnexpectedValueException(
819  "Cache type \"$id\" is not present in \$wgObjectCaches." );
820  }
821 
822  $params = $mainConfig->get( 'ObjectCaches' )[$id];
823  $params['stats'] = $services->getStatsdDataFactory();
824 
825  $store = ObjectCache::newFromParams( $params, $mainConfig );
826  $store->getLogger()->debug( 'MainObjectStash using store {class}', [
827  'class' => get_class( $store )
828  ] );
829 
830  return $store;
831  },
832 
833  'MainWANObjectCache' => static function ( MediaWikiServices $services ): WANObjectCache {
834  $mainConfig = $services->getMainConfig();
835 
836  $wanId = $mainConfig->get( 'MainWANCache' );
837  $wanParams = $mainConfig->get( 'WANObjectCaches' )[$wanId] ?? null;
838  if ( !$wanParams ) {
839  throw new UnexpectedValueException(
840  "wgWANObjectCaches must have \"$wanId\" set (via wgMainWANCache)"
841  );
842  }
843 
844  $cacheId = $wanParams['cacheId'];
845  $wanClass = $wanParams['class'];
846  unset( $wanParams['cacheId'] );
847  unset( $wanParams['class'] );
848 
849  $storeParams = $mainConfig->get( 'ObjectCaches' )[$cacheId] ?? null;
850  if ( !$storeParams ) {
851  throw new UnexpectedValueException(
852  "wgObjectCaches must have \"$cacheId\" set (via wgWANObjectCaches)"
853  );
854  }
855  $storeParams['stats'] = $services->getStatsdDataFactory();
856  $store = ObjectCache::newFromParams( $storeParams, $mainConfig );
857  $logger = $store->getLogger();
858  $logger->debug( 'MainWANObjectCache using store {class}', [
859  'class' => get_class( $store )
860  ] );
861 
862  $wanParams['cache'] = $store;
863  $wanParams['logger'] = $logger;
864  $wanParams['secret'] = $wanParams['secret'] ?? $mainConfig->get( 'SecretKey' );
865  if ( !$mainConfig->get( 'CommandLineMode' ) ) {
866  // Send the statsd data post-send on HTTP requests; avoid in CLI mode (T181385)
867  $wanParams['stats'] = $services->getStatsdDataFactory();
868  // Let pre-emptive refreshes happen post-send on HTTP requests
869  $wanParams['asyncHandler'] = [ DeferredUpdates::class, 'addCallableUpdate' ];
870  }
871 
872  $instance = new $wanClass( $wanParams );
873 
874  '@phan-var WANObjectCache $instance';
875  return $instance;
876  },
877 
878  'MediaHandlerFactory' => static function ( MediaWikiServices $services ): MediaHandlerFactory {
879  return new MediaHandlerFactory(
880  LoggerFactory::getInstance( 'MediaHandlerFactory' ),
881  $services->getMainConfig()->get( 'MediaHandlers' )
882  );
883  },
884 
885  'MergeHistoryFactory' => static function ( MediaWikiServices $services ): MergeHistoryFactory {
886  return $services->getService( '_PageCommandFactory' );
887  },
888 
889  'MessageCache' => static function ( MediaWikiServices $services ): MessageCache {
890  $mainConfig = $services->getMainConfig();
891  $clusterCache = ObjectCache::getInstance( $mainConfig->get( 'MessageCacheType' ) );
892  $srvCache = $mainConfig->get( 'UseLocalMessageCache' )
893  ? $services->getLocalServerObjectCache()
894  : new EmptyBagOStuff();
895 
896  $logger = LoggerFactory::getInstance( 'MessageCache' );
897  $logger->debug( 'MessageCache using store {class}', [
898  'class' => get_class( $clusterCache )
899  ] );
900 
901  return new MessageCache(
902  $services->getMainWANObjectCache(),
903  $clusterCache,
904  $srvCache,
905  $services->getContentLanguage(),
906  $services->getLanguageConverterFactory()->getLanguageConverter(),
907  $logger,
908  [ 'useDB' => $mainConfig->get( 'UseDatabaseMessages' ) ],
909  $services->getLanguageFactory(),
910  $services->getLocalisationCache(),
911  $services->getLanguageNameUtils(),
912  $services->getLanguageFallback(),
913  $services->getHookContainer()
914  );
915  },
916 
917  'MessageFormatterFactory' => static function ( MediaWikiServices $services ): IMessageFormatterFactory {
918  return new MessageFormatterFactory();
919  },
920 
921  'MimeAnalyzer' => static function ( MediaWikiServices $services ): MimeAnalyzer {
922  $logger = LoggerFactory::getInstance( 'Mime' );
923  $mainConfig = $services->getMainConfig();
924  $hookRunner = new HookRunner( $services->getHookContainer() );
925  $params = [
926  'typeFile' => $mainConfig->get( 'MimeTypeFile' ),
927  'infoFile' => $mainConfig->get( 'MimeInfoFile' ),
928  'xmlTypes' => $mainConfig->get( 'XMLMimeTypes' ),
929  'guessCallback' =>
930  static function ( $mimeAnalyzer, &$head, &$tail, $file, &$mime )
931  use ( $logger, $hookRunner ) {
932  // Also test DjVu
933  $deja = new DjVuImage( $file );
934  if ( $deja->isValid() ) {
935  $logger->info( "Detected $file as image/vnd.djvu\n" );
936  $mime = 'image/vnd.djvu';
937 
938  return;
939  }
940  // Some strings by reference for performance - assuming well-behaved hooks
941  $hookRunner->onMimeMagicGuessFromContent(
942  $mimeAnalyzer, $head, $tail, $file, $mime );
943  },
944  'extCallback' => static function ( $mimeAnalyzer, $ext, &$mime ) use ( $hookRunner ) {
945  // Media handling extensions can improve the MIME detected
946  $hookRunner->onMimeMagicImproveFromExtension( $mimeAnalyzer, $ext, $mime );
947  },
948  'initCallback' => static function ( $mimeAnalyzer ) use ( $hookRunner ) {
949  // Allow media handling extensions adding MIME-types and MIME-info
950  $hookRunner->onMimeMagicInit( $mimeAnalyzer );
951  },
952  'logger' => $logger
953  ];
954 
955  if ( $params['infoFile'] === 'includes/mime.info' ) {
956  $params['infoFile'] = MimeAnalyzer::USE_INTERNAL;
957  }
958 
959  if ( $params['typeFile'] === 'includes/mime.types' ) {
960  $params['typeFile'] = MimeAnalyzer::USE_INTERNAL;
961  }
962 
963  $detectorCmd = $mainConfig->get( 'MimeDetectorCommand' );
964  if ( $detectorCmd ) {
965  $factory = $services->getShellCommandFactory();
966  $params['detectCallback'] = static function ( $file ) use ( $detectorCmd, $factory ) {
967  $result = $factory->create()
968  // $wgMimeDetectorCommand can contain commands with parameters
969  ->unsafeParams( $detectorCmd )
970  ->params( $file )
971  ->execute();
972  return $result->getStdout();
973  };
974  }
975 
976  return new MimeAnalyzer( $params );
977  },
978 
979  'MovePageFactory' => static function ( MediaWikiServices $services ): MovePageFactory {
980  return $services->getService( '_PageCommandFactory' );
981  },
982 
983  'NamespaceInfo' => static function ( MediaWikiServices $services ): NamespaceInfo {
984  return new NamespaceInfo(
985  new ServiceOptions( NamespaceInfo::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
986  $services->getHookContainer()
987  );
988  },
989 
990  'NameTableStoreFactory' => static function ( MediaWikiServices $services ): NameTableStoreFactory {
991  return new NameTableStoreFactory(
992  $services->getDBLoadBalancerFactory(),
993  $services->getMainWANObjectCache(),
994  LoggerFactory::getInstance( 'NameTableSqlStore' )
995  );
996  },
997 
998  'ObjectFactory' => static function ( MediaWikiServices $services ): ObjectFactory {
999  return new ObjectFactory( $services );
1000  },
1001 
1002  'OldRevisionImporter' => static function ( MediaWikiServices $services ): OldRevisionImporter {
1003  return new ImportableOldRevisionImporter(
1004  true,
1005  LoggerFactory::getInstance( 'OldRevisionImporter' ),
1006  $services->getDBLoadBalancer(),
1007  $services->getRevisionStore(),
1008  $services->getSlotRoleRegistry(),
1009  $services->getWikiPageFactory()
1010  );
1011  },
1012 
1013  'PageEditStash' => static function ( MediaWikiServices $services ): PageEditStash {
1014  $config = $services->getMainConfig();
1015 
1016  return new PageEditStash(
1018  $services->getDBLoadBalancer(),
1019  LoggerFactory::getInstance( 'StashEdit' ),
1020  $services->getStatsdDataFactory(),
1021  $services->getUserEditTracker(),
1022  $services->getUserFactory(),
1023  $services->getHookContainer(),
1024  defined( 'MEDIAWIKI_JOB_RUNNER' ) || $config->get( 'CommandLineMode' )
1025  ? PageEditStash::INITIATOR_JOB_OR_CLI
1026  : PageEditStash::INITIATOR_USER
1027  );
1028  },
1029 
1030  'PageProps' => static function ( MediaWikiServices $services ): PageProps {
1031  return new PageProps(
1032  $services->getLinkBatchFactory(),
1033  $services->getDBLoadBalancer()
1034  );
1035  },
1036 
1037  'PageStore' => static function ( MediaWikiServices $services ): PageStore {
1038  return $services->getPageStoreFactory()->getPageStore();
1039  },
1040 
1041  'PageStoreFactory' => static function ( MediaWikiServices $services ): PageStoreFactory {
1042  $options = new ServiceOptions(
1043  PageStoreFactory::CONSTRUCTOR_OPTIONS,
1044  $services->getMainConfig()
1045  );
1046 
1047  return new PageStoreFactory(
1048  $options,
1049  $services->getDBLoadBalancerFactory(),
1050  $services->getNamespaceInfo(),
1051  $services->getTitleParser()
1052  );
1053  },
1054 
1055  'PageUpdaterFactory' => static function (
1056  MediaWikiServices $services
1057  ): PageUpdaterFactory {
1058  $editResultCache = new EditResultCache(
1059  $services->getMainObjectStash(),
1060  $services->getDBLoadBalancer(),
1061  new ServiceOptions(
1062  EditResultCache::CONSTRUCTOR_OPTIONS,
1063  $services->getMainConfig()
1064  )
1065  );
1066 
1067  return new PageUpdaterFactory(
1068  $services->getRevisionStore(),
1069  $services->getRevisionRenderer(),
1070  $services->getSlotRoleRegistry(),
1071  $services->getParserCache(),
1072  $services->getJobQueueGroup(),
1073  $services->getMessageCache(),
1074  $services->getContentLanguage(),
1075  $services->getDBLoadBalancerFactory(),
1076  $services->getContentHandlerFactory(),
1077  $services->getHookContainer(),
1078  $editResultCache,
1079  $services->getUserNameUtils(),
1080  LoggerFactory::getInstance( 'SavePage' ),
1081  new ServiceOptions(
1082  PageUpdaterFactory::CONSTRUCTOR_OPTIONS,
1083  $services->getMainConfig()
1084  ),
1085  $services->getUserEditTracker(),
1086  $services->getUserGroupManager(),
1087  $services->getTitleFormatter(),
1088  $services->getContentTransformer(),
1090  );
1091  },
1092 
1093  'Parser' => static function ( MediaWikiServices $services ): Parser {
1094  return $services->getParserFactory()->create();
1095  },
1096 
1097  'ParserCache' => static function ( MediaWikiServices $services ): ParserCache {
1098  return $services->getParserCacheFactory()
1099  ->getParserCache( ParserCacheFactory::DEFAULT_NAME );
1100  },
1101 
1102  'ParserCacheFactory' => static function ( MediaWikiServices $services ): ParserCacheFactory {
1103  $config = $services->getMainConfig();
1104  $cache = ObjectCache::getInstance( $config->get( 'ParserCacheType' ) );
1105  $wanCache = $services->getMainWANObjectCache();
1106 
1107  $options = new ServiceOptions( ParserCacheFactory::CONSTRUCTOR_OPTIONS, $config );
1108 
1109  return new ParserCacheFactory(
1110  $cache,
1111  $wanCache,
1112  $services->getHookContainer(),
1113  $services->getJsonCodec(),
1114  $services->getStatsdDataFactory(),
1115  LoggerFactory::getInstance( 'ParserCache' ),
1116  $options,
1117  $services->getTitleFactory(),
1118  $services->getWikiPageFactory()
1119  );
1120  },
1121 
1122  'ParserFactory' => static function ( MediaWikiServices $services ): ParserFactory {
1124  $services->getMainConfig()
1125  );
1126 
1127  return new ParserFactory(
1128  $options,
1129  $services->getMagicWordFactory(),
1130  $services->getContentLanguage(),
1131  wfUrlProtocols(),
1132  $services->getSpecialPageFactory(),
1133  $services->getLinkRendererFactory(),
1134  $services->getNamespaceInfo(),
1135  LoggerFactory::getInstance( 'Parser' ),
1136  $services->getBadFileLookup(),
1137  $services->getLanguageConverterFactory(),
1138  $services->getHookContainer(),
1139  $services->getTidy(),
1140  $services->getMainWANObjectCache(),
1141  $services->getUserOptionsLookup(),
1142  $services->getUserFactory(),
1143  $services->getTitleFormatter()
1144  );
1145  },
1146 
1147  'ParserOutputAccess' => static function ( MediaWikiServices $services ): ParserOutputAccess {
1148  return new ParserOutputAccess(
1149  $services->getParserCache(),
1150  $services->getParserCacheFactory()->getRevisionOutputCache( 'rcache' ),
1151  $services->getRevisionLookup(),
1152  $services->getRevisionRenderer(),
1153  $services->getStatsdDataFactory(),
1154  $services->getDBLoadBalancerFactory(),
1155  LoggerFactory::getProvider(),
1156  $services->getWikiPageFactory(),
1157  $services->getTitleFormatter()
1158  );
1159  },
1160 
1161  'PasswordFactory' => static function ( MediaWikiServices $services ): PasswordFactory {
1162  $config = $services->getMainConfig();
1163  return new PasswordFactory(
1164  $config->get( 'PasswordConfig' ),
1165  $config->get( 'PasswordDefault' )
1166  );
1167  },
1168 
1169  'PasswordReset' => static function ( MediaWikiServices $services ): PasswordReset {
1170  $options = new ServiceOptions( PasswordReset::CONSTRUCTOR_OPTIONS, $services->getMainConfig() );
1171  return new PasswordReset(
1172  $options,
1173  LoggerFactory::getInstance( 'authentication' ),
1174  $services->getAuthManager(),
1175  $services->getHookContainer(),
1176  $services->getDBLoadBalancer(),
1177  $services->getUserFactory(),
1178  $services->getUserNameUtils(),
1179  $services->getUserOptionsLookup()
1180  );
1181  },
1182 
1183  'PerDbNameStatsdDataFactory' =>
1184  static function ( MediaWikiServices $services ): StatsdDataFactoryInterface {
1185  $config = $services->getMainConfig();
1186  $wiki = $config->get( 'DBname' );
1188  $services->getStatsdDataFactory(),
1189  $wiki
1190  );
1191  },
1192 
1193  'PermissionManager' => static function ( MediaWikiServices $services ): PermissionManager {
1194  return new PermissionManager(
1195  new ServiceOptions(
1196  PermissionManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1197  ),
1198  $services->getSpecialPageFactory(),
1199  $services->getRevisionLookup(),
1200  $services->getNamespaceInfo(),
1201  $services->getGroupPermissionsLookup(),
1202  $services->getUserGroupManager(),
1203  $services->getBlockErrorFormatter(),
1204  $services->getHookContainer(),
1205  $services->getUserCache()
1206  );
1207  },
1208 
1209  'PreferencesFactory' => static function ( MediaWikiServices $services ): PreferencesFactory {
1210  $factory = new DefaultPreferencesFactory(
1211  new ServiceOptions(
1212  DefaultPreferencesFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1213  $services->getContentLanguage(),
1214  $services->getAuthManager(),
1215  $services->getLinkRendererFactory()->create(),
1216  $services->getNamespaceInfo(),
1217  $services->getPermissionManager(),
1218  $services->getLanguageConverterFactory()->getLanguageConverter(),
1219  $services->getLanguageNameUtils(),
1220  $services->getHookContainer(),
1221  $services->getUserOptionsManager(),
1222  $services->getLanguageConverterFactory(),
1223  $services->getParser(),
1224  $services->getSkinFactory(),
1225  $services->getUserGroupManager()
1226  );
1227  $factory->setLogger( LoggerFactory::getInstance( 'preferences' ) );
1228 
1229  return $factory;
1230  },
1231 
1232  'ProxyLookup' => static function ( MediaWikiServices $services ): ProxyLookup {
1233  $mainConfig = $services->getMainConfig();
1234  return new ProxyLookup(
1235  $mainConfig->get( 'CdnServers' ),
1236  $mainConfig->get( 'CdnServersNoPurge' ),
1237  $services->getHookContainer()
1238  );
1239  },
1240 
1241  'ReadOnlyMode' => static function ( MediaWikiServices $services ): ReadOnlyMode {
1242  return new ReadOnlyMode(
1243  $services->getConfiguredReadOnlyMode(),
1244  $services->getDBLoadBalancer()
1245  );
1246  },
1247 
1248  'RepoGroup' => static function ( MediaWikiServices $services ): RepoGroup {
1249  $config = $services->getMainConfig();
1250  return new RepoGroup(
1251  $config->get( 'LocalFileRepo' ),
1252  $config->get( 'ForeignFileRepos' ),
1253  $services->getMainWANObjectCache()
1254  );
1255  },
1256 
1257  'ResourceLoader' => static function ( MediaWikiServices $services ): ResourceLoader {
1258  // @todo This should not take a Config object, but it's not so easy to remove because it
1259  // exposes it in a getter, which is actually used.
1260  global $IP;
1261  $config = $services->getMainConfig();
1262 
1263  $rl = new ResourceLoader(
1264  $config,
1265  LoggerFactory::getInstance( 'resourceloader' ),
1266  $config->get( 'ResourceLoaderUseObjectCacheForDeps' )
1267  ? new KeyValueDependencyStore( $services->getMainObjectStash() )
1268  : new SqlModuleDependencyStore( $services->getDBLoadBalancer() )
1269  );
1270 
1271  $extRegistry = ExtensionRegistry::getInstance();
1272  // Attribute has precedence over config
1273  $modules = $extRegistry->getAttribute( 'ResourceModules' )
1274  + $config->get( 'ResourceModules' );
1275  $moduleSkinStyles = $extRegistry->getAttribute( 'ResourceModuleSkinStyles' )
1276  + $config->get( 'ResourceModuleSkinStyles' );
1277 
1278  $rl->setModuleSkinStyles( $moduleSkinStyles );
1279  $rl->addSource( $config->get( 'ResourceLoaderSources' ) );
1280 
1281  // Core modules, then extension/skin modules
1282  $rl->register( include "$IP/resources/Resources.php" );
1283  $rl->register( $modules );
1284  $hookRunner = new \MediaWiki\ResourceLoader\HookRunner( $services->getHookContainer() );
1285  $hookRunner->onResourceLoaderRegisterModules( $rl );
1286 
1287  $msgPosterAttrib = $extRegistry->getAttribute( 'MessagePosterModule' );
1288  $rl->register( 'mediawiki.messagePoster', [
1289  'localBasePath' => $IP,
1290  'debugRaw' => false,
1291  'scripts' => array_merge(
1292  [
1293  "resources/src/mediawiki.messagePoster/factory.js",
1294  "resources/src/mediawiki.messagePoster/MessagePoster.js",
1295  "resources/src/mediawiki.messagePoster/WikitextMessagePoster.js",
1296  ],
1297  $msgPosterAttrib['scripts'] ?? []
1298  ),
1299  'dependencies' => array_merge(
1300  [
1301  'oojs',
1302  'mediawiki.api',
1303  'mediawiki.ForeignApi',
1304  ],
1305  $msgPosterAttrib['dependencies'] ?? []
1306  ),
1307  'targets' => [ 'desktop', 'mobile' ],
1308  ] );
1309 
1310  if ( $config->get( 'EnableJavaScriptTest' ) === true ) {
1311  $rl->registerTestModules();
1312  }
1313 
1314  return $rl;
1315  },
1316 
1317  'RevertedTagUpdateManager' => static function ( MediaWikiServices $services ): RevertedTagUpdateManager {
1318  $editResultCache = new EditResultCache(
1319  $services->getMainObjectStash(),
1320  $services->getDBLoadBalancer(),
1321  new ServiceOptions(
1322  EditResultCache::CONSTRUCTOR_OPTIONS,
1323  $services->getMainConfig()
1324  )
1325  );
1326 
1327  return new RevertedTagUpdateManager(
1328  $editResultCache,
1329  $services->getJobQueueGroup()
1330  );
1331  },
1332 
1333  'RevisionFactory' => static function ( MediaWikiServices $services ): RevisionFactory {
1334  return $services->getRevisionStore();
1335  },
1336 
1337  'RevisionLookup' => static function ( MediaWikiServices $services ): RevisionLookup {
1338  return $services->getRevisionStore();
1339  },
1340 
1341  'RevisionRenderer' => static function ( MediaWikiServices $services ): RevisionRenderer {
1342  $renderer = new RevisionRenderer(
1343  $services->getDBLoadBalancer(),
1344  $services->getSlotRoleRegistry()
1345  );
1346 
1347  $renderer->setLogger( LoggerFactory::getInstance( 'SaveParse' ) );
1348  return $renderer;
1349  },
1350 
1351  'RevisionStore' => static function ( MediaWikiServices $services ): RevisionStore {
1352  return $services->getRevisionStoreFactory()->getRevisionStore();
1353  },
1354 
1355  'RevisionStoreFactory' => static function ( MediaWikiServices $services ): RevisionStoreFactory {
1356  $config = $services->getMainConfig();
1357 
1358  if ( $config->has( 'MultiContentRevisionSchemaMigrationStage' ) ) {
1359  if ( $config->get( 'MultiContentRevisionSchemaMigrationStage' ) !== SCHEMA_COMPAT_NEW ) {
1360  throw new UnexpectedValueException(
1361  'The MultiContentRevisionSchemaMigrationStage setting is no longer supported!'
1362  );
1363  }
1364  }
1365 
1366  $store = new RevisionStoreFactory(
1367  $services->getDBLoadBalancerFactory(),
1368  $services->getBlobStoreFactory(),
1369  $services->getNameTableStoreFactory(),
1370  $services->getSlotRoleRegistry(),
1371  $services->getMainWANObjectCache(),
1372  $services->getCommentStore(),
1373  $services->getActorMigration(),
1374  $services->getActorStoreFactory(),
1375  LoggerFactory::getInstance( 'RevisionStore' ),
1376  $services->getContentHandlerFactory(),
1377  $services->getPageStoreFactory(),
1378  $services->getTitleFactory(),
1379  $services->getHookContainer()
1380  );
1381 
1382  return $store;
1383  },
1384 
1385  'RollbackPageFactory' => static function ( MediaWikiServices $services ): RollbackPageFactory {
1386  return $services->get( '_PageCommandFactory' );
1387  },
1388 
1389  'SearchEngineConfig' => static function ( MediaWikiServices $services ): SearchEngineConfig {
1390  // @todo This should not take a Config object, but it's not so easy to remove because it
1391  // exposes it in a getter, which is actually used.
1392  return new SearchEngineConfig(
1393  $services->getMainConfig(),
1394  $services->getContentLanguage(),
1395  $services->getHookContainer(),
1396  ExtensionRegistry::getInstance()->getAttribute( 'SearchMappings' )
1397  );
1398  },
1399 
1400  'SearchEngineFactory' => static function ( MediaWikiServices $services ): SearchEngineFactory {
1401  return new SearchEngineFactory(
1402  $services->getSearchEngineConfig(),
1403  $services->getHookContainer(),
1404  $services->getDBLoadBalancer()
1405  );
1406  },
1407 
1408  'ShellboxClientFactory' => static function ( MediaWikiServices $services ): ShellboxClientFactory {
1409  $urls = $services->getMainConfig()->get( 'ShellboxUrls' );
1410  // TODO: Remove this logic and $wgShellboxUrl configuration in 1.38
1411  $url = $services->getMainConfig()->get( 'ShellboxUrl' );
1412  if ( $url !== null ) {
1413  $urls['default'] = $url;
1414  }
1415  return new ShellboxClientFactory(
1416  $services->getHttpRequestFactory(),
1417  $urls,
1418  $services->getMainConfig()->get( 'ShellboxSecretKey' )
1419  );
1420  },
1421 
1422  'ShellCommandFactory' => static function ( MediaWikiServices $services ): CommandFactory {
1423  $config = $services->getMainConfig();
1424 
1425  $limits = [
1426  'time' => $config->get( 'MaxShellTime' ),
1427  'walltime' => $config->get( 'MaxShellWallClockTime' ),
1428  'memory' => $config->get( 'MaxShellMemory' ),
1429  'filesize' => $config->get( 'MaxShellFileSize' ),
1430  ];
1431  $cgroup = $config->get( 'ShellCgroup' );
1432  $restrictionMethod = $config->get( 'ShellRestrictionMethod' );
1433 
1434  $factory = new CommandFactory( $services->getShellboxClientFactory(),
1435  $limits, $cgroup, $restrictionMethod );
1436  $factory->setLogger( LoggerFactory::getInstance( 'exec' ) );
1437  $factory->logStderr();
1438 
1439  return $factory;
1440  },
1441 
1442  'SiteLookup' => static function ( MediaWikiServices $services ): SiteLookup {
1443  // Use SiteStore as the SiteLookup as well. This was originally separated
1444  // to allow for a cacheable read-only interface, but this was never used.
1445  // SiteStore has caching (see below).
1446  return $services->getSiteStore();
1447  },
1448 
1449  'SiteStore' => static function ( MediaWikiServices $services ): SiteStore {
1450  $rawSiteStore = new DBSiteStore( $services->getDBLoadBalancer() );
1451 
1452  $cache = $services->getLocalServerObjectCache();
1453  if ( $cache instanceof EmptyBagOStuff ) {
1455  }
1456 
1457  return new CachingSiteStore( $rawSiteStore, $cache );
1458  },
1459 
1461  'SkinFactory' => static function ( MediaWikiServices $services ): SkinFactory {
1462  $factory = new SkinFactory(
1463  $services->getObjectFactory(),
1464  (array)$services->getMainConfig()->get( 'SkipSkins' )
1465  );
1466 
1467  $names = $services->getMainConfig()->get( 'ValidSkinNames' );
1468 
1469  foreach ( $names as $name => $skin ) {
1470  if ( is_array( $skin ) ) {
1471  $spec = $skin;
1472  $displayName = $skin['displayname'] ?? $name;
1473  } else {
1474  $displayName = $skin;
1475  $spec = [
1476  'name' => $name,
1477  'class' => "Skin$skin"
1478  ];
1479  }
1480  $factory->register( $name, $displayName, $spec );
1481  }
1482 
1483  // Register a hidden "fallback" skin
1484  $factory->register( 'fallback', 'Fallback', [
1485  'class' => SkinFallback::class,
1486  'args' => [
1487  [
1488  'name' => 'fallback',
1489  'styles' => [ 'mediawiki.skinning.interface' ],
1490  'templateDirectory' => __DIR__ . '/skins/templates/fallback',
1491  ]
1492  ]
1493  ] );
1494  // Register a hidden skin for api output
1495  $factory->register( 'apioutput', 'ApiOutput', [
1496  'class' => SkinApi::class,
1497  'args' => [
1498  [
1499  'name' => 'apioutput',
1500  'styles' => [ 'mediawiki.skinning.interface' ],
1501  'templateDirectory' => __DIR__ . '/skins/templates/apioutput',
1502  ]
1503  ]
1504  ] );
1505 
1506  return $factory;
1507  },
1508 
1509  'SlotRoleRegistry' => static function ( MediaWikiServices $services ): SlotRoleRegistry {
1510  $registry = new SlotRoleRegistry(
1511  $services->getSlotRoleStore()
1512  );
1513 
1514  $config = $services->getMainConfig();
1515  $contentHandlerFactory = $services->getContentHandlerFactory();
1516  $hookContainer = $services->getHookContainer();
1517  $titleFactory = $services->getTitleFactory();
1518  $registry->defineRole(
1519  'main',
1520  static function () use ( $config, $contentHandlerFactory, $hookContainer, $titleFactory ) {
1521  return new MainSlotRoleHandler(
1522  $config->get( 'NamespaceContentModels' ),
1523  $contentHandlerFactory,
1524  $hookContainer,
1525  $titleFactory
1526  );
1527  }
1528  );
1529 
1530  return $registry;
1531  },
1532 
1533  'SlotRoleStore' => static function ( MediaWikiServices $services ): NameTableStore {
1534  return $services->getNameTableStoreFactory()->getSlotRoles();
1535  },
1536 
1537  'SpamChecker' => static function ( MediaWikiServices $services ): SpamChecker {
1538  return new SpamChecker(
1539  (array)$services->getMainConfig()->get( 'SpamRegex' ),
1540  (array)$services->getMainConfig()->get( 'SummarySpamRegex' )
1541  );
1542  },
1543 
1544  'SpecialPageFactory' => static function ( MediaWikiServices $services ): SpecialPageFactory {
1545  return new SpecialPageFactory(
1546  new ServiceOptions(
1547  SpecialPageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1548  $services->getContentLanguage(),
1549  $services->getObjectFactory(),
1550  $services->getTitleFactory(),
1551  $services->getHookContainer()
1552  );
1553  },
1554 
1555  'StatsdDataFactory' => static function ( MediaWikiServices $services ): IBufferingStatsdDataFactory {
1556  return new BufferingStatsdDataFactory(
1557  rtrim( $services->getMainConfig()->get( 'StatsdMetricPrefix' ), '.' )
1558  );
1559  },
1560 
1561  'TalkPageNotificationManager' => static function (
1562  MediaWikiServices $services
1564  return new TalkPageNotificationManager(
1565  new ServiceOptions(
1566  TalkPageNotificationManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1567  ),
1568  $services->getDBLoadBalancer(),
1569  $services->getReadOnlyMode(),
1570  $services->getRevisionLookup()
1571  );
1572  },
1573 
1574  'TempFSFileFactory' => static function ( MediaWikiServices $services ): TempFSFileFactory {
1575  return new TempFSFileFactory( $services->getMainConfig()->get( 'TmpDirectory' ) );
1576  },
1577 
1578  'Tidy' => static function ( MediaWikiServices $services ): TidyDriverBase {
1579  return new RemexDriver(
1580  new ServiceOptions(
1581  RemexDriver::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1582  )
1583  );
1584  },
1585 
1586  'TitleFactory' => static function ( MediaWikiServices $services ): TitleFactory {
1587  return new TitleFactory();
1588  },
1589 
1590  'TitleFormatter' => static function ( MediaWikiServices $services ): TitleFormatter {
1591  return $services->getService( '_MediaWikiTitleCodec' );
1592  },
1593 
1594  'TitleParser' => static function ( MediaWikiServices $services ): TitleParser {
1595  return $services->getService( '_MediaWikiTitleCodec' );
1596  },
1597 
1598  'UnblockUserFactory' => static function ( MediaWikiServices $services ): UnblockUserFactory {
1599  return $services->getService( '_UserBlockCommandFactory' );
1600  },
1601 
1602  'UploadRevisionImporter' => static function ( MediaWikiServices $services ): UploadRevisionImporter {
1604  $services->getMainConfig()->get( 'EnableUploads' ),
1605  LoggerFactory::getInstance( 'UploadRevisionImporter' )
1606  );
1607  },
1608 
1609  'UserCache' => static function ( MediaWikiServices $services ): UserCache {
1610  return new UserCache(
1611  LoggerFactory::getInstance( 'UserCache' ),
1612  $services->getDBLoadBalancer(),
1613  $services->getLinkBatchFactory()
1614  );
1615  },
1616 
1617  'UserEditTracker' => static function ( MediaWikiServices $services ): UserEditTracker {
1618  return new UserEditTracker(
1619  $services->getActorMigration(),
1620  $services->getDBLoadBalancer(),
1621  $services->getJobQueueGroup()
1622  );
1623  },
1624 
1625  'UserFactory' => static function ( MediaWikiServices $services ): UserFactory {
1626  return new UserFactory(
1627  $services->getDBLoadBalancer(),
1628  $services->getUserNameUtils()
1629  );
1630  },
1631 
1632  'UserGroupManager' => static function ( MediaWikiServices $services ): UserGroupManager {
1633  return $services->getUserGroupManagerFactory()->getUserGroupManager();
1634  },
1635 
1636  'UserGroupManagerFactory' => static function ( MediaWikiServices $services ): UserGroupManagerFactory {
1637  return new UserGroupManagerFactory(
1638  new ServiceOptions(
1639  UserGroupManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1640  ),
1641  $services->getConfiguredReadOnlyMode(),
1642  $services->getDBLoadBalancerFactory(),
1643  $services->getHookContainer(),
1644  $services->getUserEditTracker(),
1645  $services->getGroupPermissionsLookup(),
1646  $services->getJobQueueGroupFactory(),
1647  LoggerFactory::getInstance( 'UserGroupManager' ),
1648  [ static function ( UserIdentity $user ) use ( $services ) {
1649  $services->getPermissionManager()->invalidateUsersRightsCache( $user );
1650  $services->getUserFactory()->newFromUserIdentity( $user )->invalidateCache();
1651  } ]
1652  );
1653  },
1654 
1655  'UserIdentityLookup' => static function ( MediaWikiServices $services ): UserIdentityLookup {
1656  return $services->getActorStoreFactory()->getUserIdentityLookup();
1657  },
1658 
1659  'UserNamePrefixSearch' => static function ( MediaWikiServices $services ): UserNamePrefixSearch {
1660  return new UserNamePrefixSearch(
1661  $services->getDBLoadBalancer(),
1662  $services->getUserFactory(),
1663  $services->getUserNameUtils()
1664  );
1665  },
1666 
1667  'UserNameUtils' => static function ( MediaWikiServices $services ): UserNameUtils {
1668  $messageFormatterFactory = new MessageFormatterFactory( Message::FORMAT_PLAIN );
1669  return new UserNameUtils(
1670  new ServiceOptions(
1671  UserNameUtils::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1672  ),
1673  $services->getContentLanguage(),
1674  LoggerFactory::getInstance( 'UserNameUtils' ),
1675  $services->getTitleParser(),
1676  $messageFormatterFactory->getTextFormatter(
1677  $services->getContentLanguage()->getCode()
1678  ),
1679  $services->getHookContainer()
1680  );
1681  },
1682 
1683  'UserOptionsLookup' => static function ( MediaWikiServices $services ): UserOptionsLookup {
1684  return $services->getUserOptionsManager();
1685  },
1686 
1687  'UserOptionsManager' => static function ( MediaWikiServices $services ): UserOptionsManager {
1688  return new UserOptionsManager(
1689  new ServiceOptions( UserOptionsManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1690  $services->get( '_DefaultOptionsLookup' ),
1691  $services->getLanguageConverterFactory(),
1692  $services->getDBLoadBalancer(),
1693  LoggerFactory::getInstance( 'UserOptionsManager' ),
1694  $services->getHookContainer()
1695  );
1696  },
1697 
1698  'VirtualRESTServiceClient' =>
1699  static function ( MediaWikiServices $services ): VirtualRESTServiceClient {
1700  $config = $services->getMainConfig()->get( 'VirtualRestConfig' );
1701 
1702  $vrsClient = new VirtualRESTServiceClient(
1703  $services->getHttpRequestFactory()->createMultiClient() );
1704  foreach ( $config['paths'] as $prefix => $serviceConfig ) {
1705  $class = $serviceConfig['class'];
1706  // Merge in the global defaults
1707  $constructArg = $serviceConfig['options'] ?? [];
1708  $constructArg += $config['global'];
1709  // Make the VRS service available at the mount point
1710  $vrsClient->mount( $prefix, [ 'class' => $class, 'config' => $constructArg ] );
1711  }
1712 
1713  return $vrsClient;
1714  },
1715 
1716  'WatchedItemQueryService' =>
1717  static function ( MediaWikiServices $services ): WatchedItemQueryService {
1718  return new WatchedItemQueryService(
1719  $services->getDBLoadBalancer(),
1720  $services->getCommentStore(),
1721  $services->getWatchedItemStore(),
1722  $services->getHookContainer(),
1723  $services->getMainConfig()->get( 'WatchlistExpiry' )
1724  );
1725  },
1726 
1727  'WatchedItemStore' => static function ( MediaWikiServices $services ): WatchedItemStore {
1728  $store = new WatchedItemStore(
1730  $services->getMainConfig() ),
1731  $services->getDBLoadBalancerFactory(),
1732  $services->getJobQueueGroup(),
1733  $services->getMainObjectStash(),
1734  new HashBagOStuff( [ 'maxKeys' => 100 ] ),
1735  $services->getReadOnlyMode(),
1736  $services->getNamespaceInfo(),
1737  $services->getRevisionLookup(),
1738  $services->getHookContainer(),
1739  $services->getLinkBatchFactory(),
1740  $services->getUserFactory(),
1741  $services->getTitleFactory()
1742  );
1743  $store->setStatsdDataFactory( $services->getStatsdDataFactory() );
1744 
1745  if ( $services->getMainConfig()->get( 'ReadOnlyWatchedItemStore' ) ) {
1746  $store = new NoWriteWatchedItemStore( $store );
1747  }
1748 
1749  return $store;
1750  },
1751 
1752  'WatchlistManager' => static function ( MediaWikiServices $services ): WatchlistManager {
1753  return new WatchlistManager(
1754  new ServiceOptions(
1755  WatchlistManager::CONSTRUCTOR_OPTIONS,
1756  $services->getMainConfig()
1757  ),
1758  $services->getHookContainer(),
1759  $services->getReadOnlyMode(),
1760  $services->getRevisionLookup(),
1761  $services->getTalkPageNotificationManager(),
1762  $services->getWatchedItemStore(),
1763  $services->getUserFactory(),
1764  $services->getNamespaceInfo(),
1765  $services->getWikiPageFactory()
1766  );
1767  },
1768 
1769  'WikiImporterFactory' => static function ( MediaWikiServices $services ): WikiImporterFactory {
1770  return new WikiImporterFactory(
1771  $services->getMainConfig(),
1772  $services->getHookContainer(),
1773  $services->getContentLanguage(),
1774  $services->getNamespaceInfo(),
1775  $services->getTitleFactory(),
1776  $services->getWikiPageFactory(),
1777  $services->getWikiRevisionUploadImporter(),
1778  $services->getPermissionManager(),
1779  $services->getContentHandlerFactory(),
1780  $services->getSlotRoleRegistry()
1781  );
1782  },
1783 
1784  'WikiPageFactory' => static function ( MediaWikiServices $services ): WikiPageFactory {
1785  return new WikiPageFactory(
1786  $services->getTitleFactory(),
1787  new HookRunner( $services->getHookContainer() ),
1788  $services->getDBLoadBalancer()
1789  );
1790  },
1791 
1792  'WikiRevisionOldRevisionImporterNoUpdates' =>
1793  static function ( MediaWikiServices $services ): ImportableOldRevisionImporter {
1794  return new ImportableOldRevisionImporter(
1795  false,
1796  LoggerFactory::getInstance( 'OldRevisionImporter' ),
1797  $services->getDBLoadBalancer(),
1798  $services->getRevisionStore(),
1799  $services->getSlotRoleRegistry(),
1800  $services->getWikiPageFactory()
1801  );
1802  },
1803 
1804  '_DefaultOptionsLookup' => static function ( MediaWikiServices $services ): DefaultOptionsLookup {
1805  return new DefaultOptionsLookup(
1806  new ServiceOptions( DefaultOptionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1807  $services->getContentLanguage(),
1808  $services->getHookContainer()
1809  );
1810  },
1811 
1812  '_EditConstraintFactory' => static function ( MediaWikiServices $services ): EditConstraintFactory {
1813  // This service is internal and currently only exists because a significant number
1814  // of dependencies will be needed by different constraints. It is not part of
1815  // the public interface and has no corresponding method in MediaWikiServices
1816  return new EditConstraintFactory(
1817  // Multiple
1818  new ServiceOptions(
1819  EditConstraintFactory::CONSTRUCTOR_OPTIONS,
1820  $services->getMainConfig()
1821  ),
1822  LoggerFactory::getProvider(),
1823 
1824  // UserBlockConstraint
1825  $services->getPermissionManager(),
1826 
1827  // EditFilterMergedContentHookConstraint
1828  $services->getHookContainer(),
1829 
1830  // ReadOnlyConstraint
1831  $services->getReadOnlyMode(),
1832 
1833  // SpamRegexConstraint
1834  $services->getSpamChecker()
1835  );
1836  },
1837 
1838  '_MediaWikiTitleCodec' => static function ( MediaWikiServices $services ): MediaWikiTitleCodec {
1839  return new MediaWikiTitleCodec(
1840  $services->getContentLanguage(),
1841  $services->getGenderCache(),
1842  $services->getMainConfig()->get( 'LocalInterwikis' ),
1843  $services->getInterwikiLookup(),
1844  $services->getNamespaceInfo()
1845  );
1846  },
1847 
1848  '_PageCommandFactory' => static function ( MediaWikiServices $services ): PageCommandFactory {
1849  return new PageCommandFactory(
1850  $services->getMainConfig(),
1851  $services->getDBLoadBalancer(),
1852  $services->getNamespaceInfo(),
1853  $services->getWatchedItemStore(),
1854  $services->getRepoGroup(),
1855  $services->getReadOnlyMode(),
1856  $services->getContentHandlerFactory(),
1857  $services->getRevisionStore(),
1858  $services->getSpamChecker(),
1859  $services->getTitleFormatter(),
1860  $services->getHookContainer(),
1861  $services->getWikiPageFactory(),
1862  $services->getUserFactory(),
1863  $services->getActorMigration(),
1864  $services->getActorNormalization(),
1865  $services->getTitleFactory(),
1866  $services->getUserEditTracker()
1867  );
1868  },
1869 
1870  '_SqlBlobStore' => static function ( MediaWikiServices $services ): SqlBlobStore {
1871  return $services->getBlobStoreFactory()->newSqlBlobStore();
1872  },
1873 
1874  '_UserBlockCommandFactory' => static function ( MediaWikiServices $services ): UserBlockCommandFactory {
1875  return new UserBlockCommandFactory(
1876  new ServiceOptions( UserBlockCommandFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1877  $services->getHookContainer(),
1878  $services->getBlockPermissionCheckerFactory(),
1879  $services->getBlockUtils(),
1880  $services->getDatabaseBlockStore(),
1881  $services->getBlockRestrictionStore(),
1882  $services->getUserFactory(),
1883  $services->getUserEditTracker(),
1884  LoggerFactory::getInstance( 'BlockManager' ),
1885  $services->getTitleFactory(),
1886  $services->getBlockActionInfo()
1887  );
1888  },
1889 
1891  // NOTE: When adding a service here, don't forget to add a getter function
1892  // in the MediaWikiServices class. The convenience getter should just call
1893  // $this->getService( 'FooBarService' ).
1895 
1896 ];
MediaWiki\Block\UserBlockCommandFactory
Definition: UserBlockCommandFactory.php:33
PasswordReset\CONSTRUCTOR_OPTIONS
const CONSTRUCTOR_OPTIONS
Definition: PasswordReset.php:77
EventRelayerGroup
Factory class for spawning EventRelayer objects using configuration.
Definition: EventRelayerGroup.php:26
LocalisationCache\CONSTRUCTOR_OPTIONS
const CONSTRUCTOR_OPTIONS
Definition: LocalisationCache.php:235
LinkCache
Cache for article titles (prefixed DB keys) and ids linked from one source.
Definition: LinkCache.php:40
MediaWiki\Block\BlockPermissionCheckerFactory
Factory class for BlockPermissionChecker.
Definition: BlockPermissionCheckerFactory.php:33
MediaWikiTitleCodec
A codec for MediaWiki page titles.
Definition: MediaWikiTitleCodec.php:39
WikiMap\getCurrentWikiDbDomain
static getCurrentWikiDbDomain()
Definition: WikiMap.php:293
MediaWiki\Block\BlockUserFactory
Definition: BlockUserFactory.php:30
UploadRevisionImporter
Definition: UploadRevisionImporter.php:6
Wikimedia\UUID\GlobalIdGenerator
Class for getting statistically unique IDs without a central coordinator.
Definition: GlobalIdGenerator.php:34
FileBackendGroup
Class to handle file backend registration.
Definition: FileBackendGroup.php:37
ObjectCache\getLocalClusterInstance
static getLocalClusterInstance()
Get the main cluster-local cache object.
Definition: ObjectCache.php:272
MessageBlobStore\clearGlobalCacheEntry
static clearGlobalCacheEntry(WANObjectCache $cache)
Invalidate cache keys for all known modules.
Definition: MessageBlobStore.php:189
MagicWordFactory
A factory that stores information about MagicWords, and creates them on demand with caching.
Definition: MagicWordFactory.php:37
HashBagOStuff
Simple store for keeping values in an associative array for the current process.
Definition: HashBagOStuff.php:32
ImportableOldRevisionImporter
Definition: ImportableOldRevisionImporter.php:14
MediaWiki\Interwiki\ClassicInterwikiLookup
InterwikiLookup implementing the "classic" interwiki storage (hardcoded up to MW 1....
Definition: ClassicInterwikiLookup.php:49
EmptyBagOStuff
A BagOStuff object with no objects in it.
Definition: EmptyBagOStuff.php:29
UserCache
Definition: UserCache.php:32
MediaWiki\Revision\MainSlotRoleHandler
A SlotRoleHandler for the main slot.
Definition: MainSlotRoleHandler.php:44
MediaWiki\Block\BlockManager
A service class for checking blocks.
Definition: BlockManager.php:47
MediaWiki\Permissions\GroupPermissionsLookup
Definition: GroupPermissionsLookup.php:30
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:186
MediaWiki\BadFileLookup
Definition: BadFileLookup.php:13
MimeAnalyzer
Implements functions related to MIME types such as detection and mapping to file extension.
Definition: MimeAnalyzer.php:33
Page\ParserOutputAccess
Service for getting rendered output of a given page.
Definition: ParserOutputAccess.php:50
MediaWiki\Revision\RevisionStore
Service for looking up page revisions.
Definition: RevisionStore.php:88
ObjectCache\makeLocalServerCache
static makeLocalServerCache()
Create a new BagOStuff instance for local-server caching.
Definition: ObjectCache.php:299
MediaWiki\Storage\SqlBlobStore
Service for storing and loading Content objects.
Definition: SqlBlobStore.php:52
MediaWiki\Block\BlockErrorFormatter
A service class for getting formatted information about a block.
Definition: BlockErrorFormatter.php:36
MediaWiki\Http\HttpRequestFactory
Factory creating MWHttpRequest objects.
Definition: HttpRequestFactory.php:39
MediaWiki\Languages\LanguageFactory
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: LanguageFactory.php:42
MediaWiki\Linker\LinkRenderer
Class that generates HTML links for pages.
Definition: LinkRenderer.php:43
WANObjectCache\get
get( $key, &$curTTL=null, array $checkKeys=[], &$info=[])
Fetch the value of a key from cache.
Definition: WANObjectCache.php:441
MediaWiki\Block\BlockUtils
Backend class for blocking utils.
Definition: BlockUtils.php:45
MediaWiki\SpecialPage\SpecialPageFactory
Factory for handling the special page list and generating SpecialPage objects.
Definition: SpecialPageFactory.php:63
ReadOnlyMode
A service class for fetching the wiki's current read-only mode.
Definition: ReadOnlyMode.php:11
MediaWiki\FileBackend\LockManager\LockManagerGroupFactory
Service to construct LockManagerGroups.
Definition: LockManagerGroupFactory.php:11
CachingSiteStore
Definition: CachingSiteStore.php:31
Message\MessageFormatterFactory
The MediaWiki-specific implementation of IMessageFormatterFactory.
Definition: MessageFormatterFactory.php:12
Page\RollbackPageFactory
Definition: RollbackPageFactory.php:32
MediaWiki\HookContainer\DeprecatedHooks
Definition: DeprecatedHooks.php:27
GenderCache
Caches user genders when needed to use correct namespace aliases.
Definition: GenderCache.php:36
DjVuImage
Support for detecting/validating DjVu image files and getting some basic file metadata (resolution et...
Definition: DjVuImage.php:38
MediaWiki\Languages\LanguageFallback
Definition: LanguageFallback.php:31
ConfiguredReadOnlyMode
A read-only mode service which does not depend on LoadBalancer.
Definition: ConfiguredReadOnlyMode.php:9
CommentStore
Handle database storage of comments such as edit summaries and log reasons.
Definition: CommentStore.php:42
$file
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition: router.php:42
BagOStuff
Class representing a cache/ephemeral data store.
Definition: BagOStuff.php:86
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition: GlobalFunctions.php:1182
MediaWiki\Linker\LinkRendererFactory
Factory to create LinkRender objects.
Definition: LinkRendererFactory.php:34
SearchEngineFactory
Factory class for SearchEngine.
Definition: SearchEngineFactory.php:12
MediaWiki\Revision\RevisionFactory
Service for constructing RevisionRecord objects.
Definition: RevisionFactory.php:37
ActorMigration
This is not intended to be a long-term part of MediaWiki; it will be deprecated and removed once acto...
Definition: ActorMigration.php:15
MIGRATION_NEW
const MIGRATION_NEW
Definition: Defines.php:303
MediaWiki\Block\DatabaseBlockStore
Definition: DatabaseBlockStore.php:47
Parser\ParserCacheFactory
Definition: ParserCacheFactory.php:40
MediaWiki\User\ActorStoreFactory
Definition: ActorStoreFactory.php:35
MWLBFactory\setDomainAliases
static setDomainAliases(ILBFactory $lbFactory)
Definition: MWLBFactory.php:332
MediaWiki\Languages\LanguageConverterFactory
An interface for creating language converters.
Definition: LanguageConverterFactory.php:46
MediaWiki\User\UserIdentity
Interface for objects representing user identity.
Definition: UserIdentity.php:39
SiteLookup
Definition: SiteLookup.php:28
MediaWiki\Revision\RevisionLookup
Service for looking up page revisions.
Definition: RevisionLookup.php:38
WatchedItemStore\CONSTRUCTOR_OPTIONS
const CONSTRUCTOR_OPTIONS
Definition: WatchedItemStore.php:34
ExternalStoreAccess
Key/value blob storage for a collection of storage medium types (e.g.
Definition: ExternalStoreAccess.php:22
MediaHandlerFactory
Class to construct MediaHandler objects.
Definition: MediaHandlerFactory.php:31
MediaWiki\User\TalkPageNotificationManager
Manages user talk page notifications.
Definition: TalkPageNotificationManager.php:35
MediaWiki\Languages\LanguageNameUtils
A service that provides utilities to do with language names and codes.
Definition: LanguageNameUtils.php:42
MediaWiki\EditPage\Constraint\EditConstraintFactory
Constraints reflect possible errors that need to be checked.
Definition: EditConstraintFactory.php:43
SiteStore
Definition: SiteStore.php:29
MediaWiki\User\DefaultOptionsLookup
A service class to control default user options.
Definition: DefaultOptionsLookup.php:35
ExtensionRegistry\getInstance
static getInstance()
Definition: ExtensionRegistry.php:136
WANObjectCache\newEmpty
static newEmpty()
Get an instance that wraps EmptyBagOStuff.
Definition: WANObjectCache.php:382
Config
Interface for configuration instances.
Definition: Config.php:30
MediaWiki\User\UserGroupManager
Managers user groups.
Definition: UserGroupManager.php:52
ObjectCache\newFromParams
static newFromParams(array $params, Config $conf=null)
Create a new cache object from parameters.
Definition: ObjectCache.php:139
Page\MergeHistoryFactory
Definition: MergeHistoryFactory.php:30
BagOStuff\get
get( $key, $flags=0)
Get an item with the given key.
MWLBFactory\applyDefaultConfig
static applyDefaultConfig(array $lbConf, ServiceOptions $options, ConfiguredReadOnlyMode $readOnlyMode, BagOStuff $cpStash, BagOStuff $srvCache, WANObjectCache $wanCache, CriticalSectionProvider $csProvider)
Definition: MWLBFactory.php:79
MediaWiki\Tidy\RemexDriver
Definition: RemexDriver.php:13
MWLBFactory\APPLY_DEFAULT_CONFIG_OPTIONS
const APPLY_DEFAULT_CONFIG_OPTIONS
Definition: MWLBFactory.php:47
MediaWiki\Config\ServiceOptions
A class for passing options to services.
Definition: ServiceOptions.php:27
MediaWiki\Logger\LoggerFactory
PSR-3 logger instance factory.
Definition: LoggerFactory.php:45
MediaWiki\Storage\PageEditStash
Class for managing stashed edits used by the page updater classes.
Definition: PageEditStash.php:48
DateFormatterFactory
Definition: DateFormatterFactory.php:3
MediaWiki\Watchlist\WatchlistManager
WatchlistManager service.
Definition: WatchlistManager.php:52
LocalisationCache\getStoreFromConf
static getStoreFromConf(array $conf, $fallbackCacheDir)
Return a suitable LCStore as specified by the given configuration.
Definition: LocalisationCache.php:207
WikiMap\getWikiIdFromDbDomain
static getWikiIdFromDbDomain( $domain)
Get the wiki ID of a database domain.
Definition: WikiMap.php:269
CryptHKDF
Definition: CryptHKDF.php:33
MediaWiki\Cache\LinkBatchFactory
Definition: LinkBatchFactory.php:39
WatchedItemQueryService
Definition: WatchedItemQueryService.php:23
ProxyLookup
Definition: ProxyLookup.php:29
VirtualRESTServiceClient
Virtual HTTP service client loosely styled after a Virtual File System.
Definition: VirtualRESTServiceClient.php:45
$modules
$modules
Definition: HTMLFormElement.php:15
MediaWiki\Interwiki\InterwikiLookup
Service interface for looking up Interwiki records.
Definition: InterwikiLookup.php:32
MediaWiki\User\UserNamePrefixSearch
Handles searching prefixes of user names.
Definition: UserNamePrefixSearch.php:39
MediaWiki\Content\ContentHandlerFactory
Definition: ContentHandlerFactory.php:44
MediaWiki\Block\UnblockUserFactory
Definition: UnblockUserFactory.php:30
MediaWiki\Content\Transform\ContentTransformer
A service to transform content.
Definition: ContentTransformer.php:15
ObjectCache\getInstance
static getInstance( $id)
Get a cached instance of the specified type of cache object.
Definition: ObjectCache.php:74
BufferingStatsdDataFactory
A factory for application metric data.
Definition: BufferingStatsdDataFactory.php:36
MWLBFactory\getLBFactoryClass
static getLBFactoryClass(array $config)
Decide which LBFactory class to use.
Definition: MWLBFactory.php:313
Page\WikiPageFactory
Definition: WikiPageFactory.php:20
DBSiteStore
Definition: DBSiteStore.php:33
ChangeTags\getSoftwareTags
static getSoftwareTags( $all=false)
Loads defined core tags, checks for invalid types (if not array), and filters for supported and enabl...
Definition: ChangeTags.php:158
MediaWiki\Actions\ActionFactory
Definition: ActionFactory.php:44
MediaWiki\Storage\BlobStoreFactory
Service for instantiating BlobStores.
Definition: BlobStoreFactory.php:35
TitleParser
A title parser service for MediaWiki.
Definition: TitleParser.php:33
NamespaceInfo\CONSTRUCTOR_OPTIONS
const CONSTRUCTOR_OPTIONS
Definition: NamespaceInfo.php:88
FileBackendGroup\CONSTRUCTOR_OPTIONS
const CONSTRUCTOR_OPTIONS
Definition: FileBackendGroup.php:68
JobRunner\CONSTRUCTOR_OPTIONS
const CONSTRUCTOR_OPTIONS
Definition: JobRunner.php:46
MediaWiki\Tidy\TidyDriverBase
Base class for HTML cleanup utilities.
Definition: TidyDriverBase.php:8
Wikimedia\DependencyStore\SqlModuleDependencyStore
Class for tracking per-entity dependency path lists in the module_deps table.
Definition: SqlModuleDependencyStore.php:37
MediaWiki\FileBackend\FSFile\TempFSFileFactory
Definition: TempFSFileFactory.php:10
wfUrlProtocols
wfUrlProtocols( $includeProtocolRelative=true)
Returns a regular expression of url protocols.
Definition: GlobalFunctions.php:702
MediaWiki\User\UserGroupManagerFactory
Factory service for UserGroupManager instances.
Definition: UserGroupManagerFactory.php:37
MediaWiki\User\UserIdentityLookup
Definition: UserIdentityLookup.php:33
ExternalStoreFactory
Definition: ExternalStoreFactory.php:14
MediaWiki\Revision\RevisionRenderer
The RevisionRenderer service provides access to rendered output for revisions.
Definition: RevisionRenderer.php:45
MediaWiki\Permissions\PermissionManager
A service class for checking permissions To obtain an instance, use MediaWikiServices::getInstance()-...
Definition: PermissionManager.php:53
ParserFactory
Definition: ParserFactory.php:36
Parser\CONSTRUCTOR_OPTIONS
const CONSTRUCTOR_OPTIONS
Definition: Parser.php:365
MediaWiki\User\BotPasswordStore
Definition: BotPasswordStore.php:44
PrefixingStatsdDataFactoryProxy
Proxy to prefix metric keys sent to a StatsdDataFactoryInterface.
Definition: PrefixingStatsdDataFactoryProxy.php:29
MediaWiki\HookContainer\GlobalHookRegistry
A HookRegistry which sources its data from dynamically changing sources: $wgHooks and an ExtensionReg...
Definition: GlobalHookRegistry.php:11
MediaWiki\Content\IContentHandlerFactory
Definition: IContentHandlerFactory.php:10
SkinFactory
Factory class to create Skin objects.
Definition: SkinFactory.php:31
MediaWiki\Storage\EditResultCache
Class allowing easy storage and retrieval of EditResults associated with revisions.
Definition: EditResultCache.php:42
MediaWiki\EditPage\SpamChecker
Service to check if text (either content or a summary) qualifies as spam.
Definition: SpamChecker.php:14
MediaWiki\JobQueue\JobQueueGroupFactory
Class to construct JobQueueGroups.
Definition: JobQueueGroupFactory.php:37
MediaWiki\Shell\CommandFactory
Factory facilitating dependency injection for Command.
Definition: CommandFactory.php:35
MediaWiki\Preferences\PreferencesFactory
A PreferencesFactory is a MediaWiki service that provides the definitions of preferences for a given ...
Definition: PreferencesFactory.php:54
WANObjectCache
Multi-datacenter aware caching interface.
Definition: WANObjectCache.php:128
HtmlCacheUpdater
Class to invalidate the CDN and HTMLFileCache entries associated with URLs/titles.
Definition: HtmlCacheUpdater.php:32
MediaWiki\User\CentralId\CentralIdLookupFactory
Definition: CentralIdLookupFactory.php:34
LocalisationCache
Class for caching the contents of localisation files, Messages*.php and *.i18n.php.
Definition: LocalisationCache.php:43
MediaWiki\Config\ConfigRepository
Object which holds currently registered configuration options.
Definition: ConfigRepository.php:33
MediaWiki\Mail\Emailer
Definition: Emailer.php:31
Wikimedia\DependencyStore\KeyValueDependencyStore
Lightweight class for tracking path dependencies lists via an object cache instance.
Definition: KeyValueDependencyStore.php:36
MediaWiki\Storage\NameTableStore
Definition: NameTableStore.php:36
MediaWiki\Block\BlockActionInfo
Defines the actions that can be blocked by a partial block.
Definition: BlockActionInfo.php:40
Parser
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
Definition: Parser.php:89
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:484
MWLBFactory\applyGlobalState
static applyGlobalState(ILBFactory $lbFactory, Config $config, IBufferingStatsdDataFactory $stats)
Apply global state from the current web request or other PHP process.
Definition: MWLBFactory.php:366
MediaWiki\Revision\RevisionStoreFactory
Factory service for RevisionStore instances.
Definition: RevisionStoreFactory.php:55
MediaWiki\Shell\ShellboxClientFactory
This is a service which provides a configured client to access a remote Shellbox installation.
Definition: ShellboxClientFactory.php:15
MediaWiki\User\UserOptionsLookup
Provides access to user options.
Definition: UserOptionsLookup.php:29
Page\MovePageFactory
Definition: MovePageFactory.php:30
MediaWiki\Auth\AuthManager
This serves as the entry point to the authentication system.
Definition: AuthManager.php:98
MediaWiki\Storage\BlobStore
Service for loading and storing data blobs.
Definition: BlobStore.php:35
MediaWiki\Revision\ContributionsLookup
Definition: ContributionsLookup.php:23
MediaWiki\User\UserOptionsManager
A service class to control user options.
Definition: UserOptionsManager.php:43
WatchedItemStore
Storage layer class for WatchedItems.
Definition: WatchedItemStore.php:29
Page\PageCommandFactory
Common factory to construct page handling classes.
Definition: PageCommandFactory.php:60
IBufferingStatsdDataFactory
MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.
Definition: IBufferingStatsdDataFactory.php:13
Wikimedia\Message\IMessageFormatterFactory
A simple factory providing a message formatter for a given language code.
Definition: IMessageFormatterFactory.php:10
$command
$command
Definition: mcc.php:125
ImportableUploadRevisionImporter
Definition: ImportableUploadRevisionImporter.php:9
ResourceLoader
ResourceLoader is a loading system for JavaScript and CSS resources.
Definition: ResourceLoader.php:58
OldRevisionImporter
Definition: OldRevisionImporter.php:6
$cache
$cache
Definition: mcc.php:33
MediaWiki\User\UserEditTracker
Track info about user edit counts and timings.
Definition: UserEditTracker.php:21
PageProps
Gives access to properties of a page.
Definition: PageProps.php:33
MediaWiki\User\UserNameUtils
UserNameUtils service.
Definition: UserNameUtils.php:42
CentralIdLookup
The CentralIdLookup service allows for connecting local users with cluster-wide IDs.
Definition: CentralIdLookup.php:35
TitleFormatter
A title formatter service for MediaWiki.
Definition: TitleFormatter.php:35
TitleFactory
Creates Title objects.
Definition: TitleFactory.php:35
Page\ContentModelChangeFactory
Definition: ContentModelChangeFactory.php:32
MediaWiki\Mail\IEmailer
Interface for sending emails.
Definition: IEmailer.php:34
Wikimedia
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
RepoGroup
Prioritized list of file repositories.
Definition: RepoGroup.php:33
ParserCache
Cache for ParserOutput objects corresponding to the latest page revisions.
Definition: ParserCache.php:63
ConfigFactory
Factory class to create Config objects.
Definition: ConfigFactory.php:31
MediaWiki\Storage\PageUpdaterFactory
A factory for PageUpdater instances.
Definition: PageUpdaterFactory.php:52
MediaWiki\Preferences\DefaultPreferencesFactory
This is the default implementation of PreferencesFactory.
Definition: DefaultPreferencesFactory.php:70
MediaWiki\Storage\NameTableStoreFactory
Definition: NameTableStoreFactory.php:26
SearchEngineConfig
Configuration handling class for SearchEngine.
Definition: SearchEngineConfig.php:12
MediaWiki\Revision\SlotRoleRegistry
A registry service for SlotRoleHandlers, used to define which slot roles are available on which page.
Definition: SlotRoleRegistry.php:48
$ext
if(!is_readable( $file)) $ext
Definition: router.php:48
MediaWiki\Config\ServiceOptions\get
get( $key)
Definition: ServiceOptions.php:93
MediaWiki\HookContainer\HookContainer
HookContainer class.
Definition: HookContainer.php:45
PasswordFactory
Factory class for creating and checking Password objects.
Definition: PasswordFactory.php:30
wfWarn
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
Definition: GlobalFunctions.php:1043
NamespaceInfo
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Definition: NamespaceInfo.php:35
MediaWiki\HookContainer\HookRunner
This class provides an implementation of the core hook interfaces, forwarding hook calls to HookConta...
Definition: HookRunner.php:555
WikiImporterFactory
Factory service for WikiImporter instances.
Definition: WikiImporterFactory.php:33
MediaWiki\Json\JsonCodec
Definition: JsonCodec.php:36
$mime
$mime
Definition: router.php:60
JobRunner
Job queue runner utility methods.
Definition: JobRunner.php:41
Page\PageStore
Definition: PageStore.php:26
MessageCache
Cache of messages that are defined by MediaWiki namespace pages or by hooks.
Definition: MessageCache.php:52
$IP
$IP
Definition: WebStart.php:49
Message\FORMAT_PLAIN
const FORMAT_PLAIN
Use message text as-is.
Definition: Message.php:140
Page\PageStoreFactory
Definition: PageStoreFactory.php:14
PasswordReset
Helper class for the password reset functionality shared by the web UI and the API.
Definition: PasswordReset.php:43
MediaWiki\User\UserFactory
Creates User objects.
Definition: UserFactory.php:41
SCHEMA_COMPAT_NEW
const SCHEMA_COMPAT_NEW
Definition: Defines.php:276
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:42
MediaWiki\User\ActorStore
Definition: ActorStore.php:43
MediaWiki\Storage\RevertedTagUpdateManager
Class for managing delayed RevertedTagUpdateJob waiting for user approval.
Definition: RevertedTagUpdateManager.php:36
NoWriteWatchedItemStore
Definition: NoWriteWatchedItemStore.php:31
JobQueueGroup
Class to handle enqueueing of background jobs.
Definition: JobQueueGroup.php:32
MediaWiki\Block\BlockRestrictionStore
Definition: BlockRestrictionStore.php:35
MediaWiki\User\ActorNormalization
Service for dealing with the actor table.
Definition: ActorNormalization.php:32
wfShellExec
wfShellExec( $cmd, &$retval=null, $environ=[], $limits=[], $options=[])
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported...
Definition: GlobalFunctions.php:1936