MediaWiki  master
ServiceWiring.php
Go to the documentation of this file.
1 <?php
47 use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
106 use Wikimedia\ObjectFactory;
109 
110 return [
111  'ActorMigration' => function () : ActorMigration {
112  return new ActorMigration( SCHEMA_COMPAT_NEW );
113  },
114 
115  'AuthManager' => function ( MediaWikiServices $services ) : AuthManager {
116  $authManager = new AuthManager(
117  RequestContext::getMain()->getRequest(),
118  $services->getMainConfig(),
119  $services->getObjectFactory(),
120  $services->getPermissionManager()
121  );
122  $authManager->setLogger( LoggerFactory::getInstance( 'authentication' ) );
123  return $authManager;
124  },
125 
126  'BadFileLookup' => function ( MediaWikiServices $services ) : BadFileLookup {
127  return new BadFileLookup(
128  function () {
129  return wfMessage( 'bad_image_list' )->inContentLanguage()->plain();
130  },
131  $services->getLocalServerObjectCache(),
132  $services->getRepoGroup(),
133  $services->getTitleParser()
134  );
135  },
136 
137  'BlobStore' => function ( MediaWikiServices $services ) : BlobStore {
138  return $services->getService( '_SqlBlobStore' );
139  },
140 
141  'BlobStoreFactory' => function ( MediaWikiServices $services ) : BlobStoreFactory {
142  return new BlobStoreFactory(
143  $services->getDBLoadBalancerFactory(),
144  $services->getExternalStoreAccess(),
145  $services->getMainWANObjectCache(),
146  new ServiceOptions( BlobStoreFactory::CONSTRUCTOR_OPTIONS,
147  $services->getMainConfig() )
148  );
149  },
150 
151  'BlockErrorFormatter' => function () : BlockErrorFormatter {
152  return new BlockErrorFormatter();
153  },
154 
155  'BlockManager' => function ( MediaWikiServices $services ) : BlockManager {
156  return new BlockManager(
157  new ServiceOptions(
158  BlockManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
159  ),
160  $services->getPermissionManager(),
161  LoggerFactory::getInstance( 'BlockManager' )
162  );
163  },
164 
165  'BlockRestrictionStore' => function ( MediaWikiServices $services ) : BlockRestrictionStore {
166  return new BlockRestrictionStore(
167  $services->getDBLoadBalancer()
168  );
169  },
170 
171  'CommentStore' => function ( MediaWikiServices $services ) : CommentStore {
172  return new CommentStore(
173  $services->getContentLanguage(),
175  );
176  },
177 
178  'ConfigFactory' => function ( MediaWikiServices $services ) : ConfigFactory {
179  // Use the bootstrap config to initialize the ConfigFactory.
180  $registry = $services->getBootstrapConfig()->get( 'ConfigRegistry' );
181  $factory = new ConfigFactory();
182 
183  foreach ( $registry as $name => $callback ) {
184  $factory->register( $name, $callback );
185  }
186  return $factory;
187  },
188 
189  'ConfigRepository' => function ( MediaWikiServices $services ) : ConfigRepository {
190  return new ConfigRepository( $services->getConfigFactory() );
191  },
192 
193  'ConfiguredReadOnlyMode' => function ( MediaWikiServices $services ) : ConfiguredReadOnlyMode {
194  $config = $services->getMainConfig();
195  return new ConfiguredReadOnlyMode(
196  $config->get( 'ReadOnly' ),
197  $config->get( 'ReadOnlyFile' )
198  );
199  },
200 
201  'ContentHandlerFactory' => function ( MediaWikiServices $services ) : IContentHandlerFactory {
202  $contentHandlerConfig = $services->getMainConfig()->get( 'ContentHandlers' );
203 
204  return new ContentHandlerFactory(
205  $contentHandlerConfig,
206  $services->getObjectFactory()
207  );
208  },
209 
210  'ContentLanguage' => function ( MediaWikiServices $services ) : Language {
211  return $services->getLanguageFactory()->getLanguage(
212  $services->getMainConfig()->get( 'LanguageCode' ) );
213  },
214 
215  'CryptHKDF' => function ( MediaWikiServices $services ) : CryptHKDF {
216  $config = $services->getMainConfig();
217 
218  $secret = $config->get( 'HKDFSecret' ) ?: $config->get( 'SecretKey' );
219  if ( !$secret ) {
220  throw new RuntimeException( "Cannot use MWCryptHKDF without a secret." );
221  }
222 
223  // In HKDF, the context can be known to the attacker, but this will
224  // keep simultaneous runs from producing the same output.
225  $context = [ microtime(), getmypid(), gethostname() ];
226 
227  // Setup salt cache. Use APC, or fallback to the main cache if it isn't setup
228  $cache = $services->getLocalServerObjectCache();
229  if ( $cache instanceof EmptyBagOStuff ) {
231  }
232 
233  return new CryptHKDF( $secret, $config->get( 'HKDFAlgorithm' ), $cache, $context );
234  },
235 
236  'DateFormatterFactory' => function () : DateFormatterFactory {
237  return new DateFormatterFactory;
238  },
239 
240  'DBLoadBalancer' => function ( MediaWikiServices $services ) : Wikimedia\Rdbms\ILoadBalancer {
241  // just return the default LB from the DBLoadBalancerFactory service
242  return $services->getDBLoadBalancerFactory()->getMainLB();
243  },
244 
245  'DBLoadBalancerFactory' =>
246  function ( MediaWikiServices $services ) : Wikimedia\Rdbms\LBFactory {
247  $mainConfig = $services->getMainConfig();
248 
249  try {
250  $stash = $services->getMainObjectStash();
251  } catch ( RecursiveServiceDependencyException $e ) {
252  $stash = new EmptyBagOStuff(); // T141804: handle cases like CACHE_DB
253  }
254 
255  if ( $stash instanceof EmptyBagOStuff ) {
256  // Use process cache if the main stash is disabled or there was recursion
257  $stash = new HashBagOStuff( [ 'maxKeys' => 100 ] );
258  }
259 
260  try {
261  $wanCache = $services->getMainWANObjectCache();
262  } catch ( RecursiveServiceDependencyException $e ) {
263  $wanCache = WANObjectCache::newEmpty(); // T141804: handle cases like CACHE_DB
264  }
265 
267  $mainConfig->get( 'LBFactoryConf' ),
268  new ServiceOptions( MWLBFactory::APPLY_DEFAULT_CONFIG_OPTIONS, $mainConfig ),
269  $services->getConfiguredReadOnlyMode(),
270  $services->getLocalServerObjectCache(),
271  $stash,
272  $wanCache
273  );
274 
275  $class = MWLBFactory::getLBFactoryClass( $lbConf );
276  $instance = new $class( $lbConf );
277 
278  MWLBFactory::setDomainAliases( $instance );
279 
280  return $instance;
281  },
282 
283  'Emailer' => function ( MediaWikiServices $services ) : IEmailer {
284  return new Emailer();
285  },
286 
287  'EventRelayerGroup' => function ( MediaWikiServices $services ) : EventRelayerGroup {
288  return new EventRelayerGroup( $services->getMainConfig()->get( 'EventRelayerConfig' ) );
289  },
290 
291  'ExternalStoreAccess' => function ( MediaWikiServices $services ) : ExternalStoreAccess {
292  return new ExternalStoreAccess(
293  $services->getExternalStoreFactory(),
294  LoggerFactory::getInstance( 'ExternalStore' )
295  );
296  },
297 
298  'ExternalStoreFactory' => function ( MediaWikiServices $services ) : ExternalStoreFactory {
299  $config = $services->getMainConfig();
300  $writeStores = $config->get( 'DefaultExternalStore' );
301 
302  return new ExternalStoreFactory(
303  $config->get( 'ExternalStores' ),
304  ( $writeStores !== false ) ? (array)$writeStores : [],
305  $services->getDBLoadBalancer()->getLocalDomainID(),
306  LoggerFactory::getInstance( 'ExternalStore' )
307  );
308  },
309 
310  'FileBackendGroup' => function ( MediaWikiServices $services ) : FileBackendGroup {
311  $mainConfig = $services->getMainConfig();
312 
314  $fallbackWikiId = WikiMap::getWikiIdFromDbDomain( $ld );
315  // If the local wiki ID and local domain ID do not match, probably due to a non-default
316  // schema, issue a warning. A non-default schema indicates that it might be used to
317  // disambiguate different wikis.
318  $legacyDomainId = strlen( $ld->getTablePrefix() )
319  ? "{$ld->getDatabase()}-{$ld->getTablePrefix()}"
320  : $ld->getDatabase();
321  if ( $ld->getSchema() !== null && $legacyDomainId !== $fallbackWikiId ) {
322  wfWarn(
323  "Legacy default 'domainId' is '$legacyDomainId' but wiki ID is '$fallbackWikiId'."
324  );
325  }
326 
327  $cache = $services->getLocalServerObjectCache();
328  if ( $cache instanceof EmptyBagOStuff ) {
329  $cache = new HashBagOStuff;
330  }
331 
332  return new FileBackendGroup(
334  [ 'fallbackWikiId' => $fallbackWikiId ] ),
335  $services->getConfiguredReadOnlyMode(),
336  $cache,
337  $services->getMainWANObjectCache(),
338  $services->getMimeAnalyzer(),
339  $services->getLockManagerGroupFactory(),
340  $services->getTempFSFileFactory(),
341  $services->getObjectFactory()
342  );
343  },
344 
345  'GenderCache' => function ( MediaWikiServices $services ) : GenderCache {
346  $nsInfo = $services->getNamespaceInfo();
347  // Database layer may be disabled, so processing without database connection
348  $dbLoadBalancer = $services->isServiceDisabled( 'DBLoadBalancer' )
349  ? null
350  : $services->getDBLoadBalancer();
351  return new GenderCache( $nsInfo, $dbLoadBalancer );
352  },
353 
354  'GlobalIdGenerator' => function ( MediaWikiServices $services ) : GlobalIdGenerator {
355  $mainConfig = $services->getMainConfig();
356 
357  return new GlobalIdGenerator(
358  $mainConfig->get( 'TmpDirectory' ),
359  // Ignore APC-like caches in CLI mode since there is no meaningful persistence.
360  // This avoids having counters restart with each script run. The ID generator
361  // will fallback to using the disk in those cases.
362  $mainConfig->get( 'CommandLineMode' )
363  ? new EmptyBagOStuff()
364  : $services->getLocalServerObjectCache(),
365  function ( $command ) {
366  return wfShellExec( $command );
367  }
368  );
369  },
370 
371  'HookContainer' => function ( MediaWikiServices $services ) : HookContainer {
372  $extRegistry = ExtensionRegistry::getInstance();
373  $extDeprecatedHooks = $extRegistry->getAttribute( 'DeprecatedHooks' );
374  $deprecatedHooks = new DeprecatedHooks( $extDeprecatedHooks );
375  $hookRegistry = new GlobalHookRegistry( $extRegistry, $deprecatedHooks );
376  return new HookContainer(
377  $hookRegistry,
378  $services->getObjectFactory()
379  );
380  },
381 
382  'HtmlCacheUpdater' => function ( MediaWikiServices $services ) : HtmlCacheUpdater {
383  $config = $services->getMainConfig();
384 
385  return new HtmlCacheUpdater(
386  $config->get( 'CdnReboundPurgeDelay' ),
387  $config->get( 'UseFileCache' )
388  );
389  },
390 
391  'HttpRequestFactory' =>
392  function ( MediaWikiServices $services ) : HttpRequestFactory {
393  return new HttpRequestFactory(
394  new ServiceOptions(
395  HttpRequestFactory::CONSTRUCTOR_OPTIONS,
396  $services->getMainConfig()
397  ),
398  LoggerFactory::getInstance( 'http' )
399  );
400  },
401 
402  'InterwikiLookup' => function ( MediaWikiServices $services ) : InterwikiLookup {
403  $config = $services->getMainConfig();
404  return new ClassicInterwikiLookup(
405  $services->getContentLanguage(),
406  $services->getMainWANObjectCache(),
407  $config->get( 'InterwikiExpiry' ),
408  $config->get( 'InterwikiCache' ),
409  $config->get( 'InterwikiScopes' ),
410  $config->get( 'InterwikiFallbackSite' )
411  );
412  },
413 
414  'JobRunner' => function ( MediaWikiServices $services ) : JobRunner {
415  return new JobRunner(
416  new ServiceOptions( JobRunner::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
417  $services->getDBLoadBalancerFactory(),
419  $services->getReadOnlyMode(),
420  $services->getLinkCache(),
421  $services->getStatsdDataFactory(),
422  LoggerFactory::getInstance( 'runJobs' )
423  );
424  },
425 
426  'LanguageConverterFactory' => function ( MediaWikiServices $services ) : LanguageConverterFactory {
427  $usePigLatinVariant = $services->getMainConfig()->get( 'UsePigLatinVariant' );
428  return new LanguageConverterFactory( $usePigLatinVariant, function () use ( $services ) {
429  return $services->getContentLanguage();
430  } );
431  },
432 
433  'LanguageFactory' => function ( MediaWikiServices $services ) : LanguageFactory {
434  return new LanguageFactory(
435  new ServiceOptions( LanguageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
436  $services->getLocalisationCache(),
437  $services->getLanguageNameUtils(),
438  $services->getLanguageFallback(),
439  $services->getLanguageConverterFactory()
440  );
441  },
442 
443  'LanguageFallback' => function ( MediaWikiServices $services ) : LanguageFallback {
444  return new LanguageFallback(
445  $services->getMainConfig()->get( 'LanguageCode' ),
446  $services->getLocalisationCache(),
447  $services->getLanguageNameUtils()
448  );
449  },
450 
451  'LanguageNameUtils' => function ( MediaWikiServices $services ) : LanguageNameUtils {
452  return new LanguageNameUtils( new ServiceOptions(
453  LanguageNameUtils::CONSTRUCTOR_OPTIONS,
454  $services->getMainConfig()
455  ) );
456  },
457 
458  'LinkBatchFactory' => function ( MediaWikiServices $services ) : LinkBatchFactory {
459  return new LinkBatchFactory(
460  $services->getLinkCache(),
461  $services->getTitleFormatter(),
462  $services->getContentLanguage(),
463  $services->getGenderCache(),
464  $services->getDBLoadBalancer()
465  );
466  },
467 
468  'LinkCache' => function ( MediaWikiServices $services ) : LinkCache {
469  return new LinkCache(
470  $services->getTitleFormatter(),
471  $services->getMainWANObjectCache(),
472  $services->getNamespaceInfo()
473  );
474  },
475 
476  'LinkRenderer' => function ( MediaWikiServices $services ) : LinkRenderer {
477  if ( defined( 'MW_NO_SESSION' ) ) {
478  return $services->getLinkRendererFactory()->create();
479  } else {
480  // Normally information from the current request would not be passed in here;
481  // this is an exception. (See also the class documentation.)
482  return $services->getLinkRendererFactory()->createForUser(
483  RequestContext::getMain()->getUser()
484  );
485  }
486  },
487 
488  'LinkRendererFactory' => function ( MediaWikiServices $services ) : LinkRendererFactory {
489  return new LinkRendererFactory(
490  $services->getTitleFormatter(),
491  $services->getLinkCache(),
492  $services->getNamespaceInfo(),
493  $services->getSpecialPageFactory()
494  );
495  },
496 
497  'LocalisationCache' => function ( MediaWikiServices $services ) : LocalisationCache {
498  $conf = $services->getMainConfig()->get( 'LocalisationCacheConf' );
499 
500  $logger = LoggerFactory::getInstance( 'localisation' );
501 
503  $conf, $services->getMainConfig()->get( 'CacheDirectory' ) );
504  $logger->debug( 'LocalisationCache using store ' . get_class( $store ) );
505 
506  return new $conf['class'](
507  new ServiceOptions(
508  LocalisationCache::CONSTRUCTOR_OPTIONS,
509  // Two of the options are stored in $wgLocalisationCacheConf
510  $conf,
511  // In case someone set that config variable and didn't reset all keys, set defaults.
512  [
513  'forceRecache' => false,
514  'manualRecache' => false,
515  ],
516  // Some other options come from config itself
517  $services->getMainConfig()
518  ),
519  $store,
520  $logger,
521  [ function () use ( $services ) {
522  // NOTE: Make sure we use the same cache object that is assigned in the
523  // constructor of the MessageBlobStore class used by ResourceLoader.
524  // T231866: Avoid circular dependency via ResourceLoader.
525  MessageBlobStore::clearGlobalCacheEntry( $services->getMainWANObjectCache() );
526  } ],
527  $services->getLanguageNameUtils()
528  );
529  },
530 
531  'LocalServerObjectCache' => function ( MediaWikiServices $services ) : BagOStuff {
533  },
534 
535  'LockManagerGroupFactory' => function ( MediaWikiServices $services ) : LockManagerGroupFactory {
536  return new LockManagerGroupFactory(
538  $services->getMainConfig()->get( 'LockManagers' ),
539  $services->getDBLoadBalancerFactory()
540  );
541  },
542 
543  'MagicWordFactory' => function ( MediaWikiServices $services ) : MagicWordFactory {
544  return new MagicWordFactory( $services->getContentLanguage() );
545  },
546 
547  'MainConfig' => function ( MediaWikiServices $services ) : Config {
548  // Use the 'main' config from the ConfigFactory service.
549  return $services->getConfigFactory()->makeConfig( 'main' );
550  },
551 
552  'MainObjectStash' => function ( MediaWikiServices $services ) : BagOStuff {
553  $mainConfig = $services->getMainConfig();
554 
555  $id = $mainConfig->get( 'MainStash' );
556  if ( !isset( $mainConfig->get( 'ObjectCaches' )[$id] ) ) {
557  throw new UnexpectedValueException(
558  "Cache type \"$id\" is not present in \$wgObjectCaches." );
559  }
560 
561  $params = $mainConfig->get( 'ObjectCaches' )[$id];
562 
563  $store = ObjectCache::newFromParams( $params, $mainConfig );
564  $store->getLogger()->debug( 'MainObjectStash using store {class}', [
565  'class' => get_class( $store )
566  ] );
567 
568  return $store;
569  },
570 
571  'MainWANObjectCache' => function ( MediaWikiServices $services ) : WANObjectCache {
572  $mainConfig = $services->getMainConfig();
573 
574  $wanId = $mainConfig->get( 'MainWANCache' );
575  $wanParams = $mainConfig->get( 'WANObjectCaches' )[$wanId] ?? null;
576  if ( !$wanParams ) {
577  throw new UnexpectedValueException(
578  "wgWANObjectCaches must have \"$wanId\" set (via wgMainWANCache)"
579  );
580  }
581 
582  $cacheId = $wanParams['cacheId'];
583  $wanClass = $wanParams['class'];
584  unset( $wanParams['cacheId'] );
585  unset( $wanParams['class'] );
586 
587  $storeParams = $mainConfig->get( 'ObjectCaches' )[$cacheId] ?? null;
588  if ( !$storeParams ) {
589  throw new UnexpectedValueException(
590  "wgObjectCaches must have \"$cacheId\" set (via wgWANObjectCaches)"
591  );
592  }
593  $store = ObjectCache::newFromParams( $storeParams, $mainConfig );
594  $logger = $store->getLogger();
595  $logger->debug( 'MainWANObjectCache using store {class}', [
596  'class' => get_class( $store )
597  ] );
598 
599  $wanParams['cache'] = $store;
600  $wanParams['logger'] = $logger;
601  $wanParams['secret'] = $wanParams['secret'] ?? $mainConfig->get( 'SecretKey' );
602  if ( !$mainConfig->get( 'CommandLineMode' ) ) {
603  // Send the statsd data post-send on HTTP requests; avoid in CLI mode (T181385)
604  $wanParams['stats'] = $services->getStatsdDataFactory();
605  // Let pre-emptive refreshes happen post-send on HTTP requests
606  $wanParams['asyncHandler'] = [ DeferredUpdates::class, 'addCallableUpdate' ];
607  }
608 
609  $instance = new $wanClass( $wanParams );
610 
611  '@phan-var WANObjectCache $instance';
612  return $instance;
613  },
614 
615  'MediaHandlerFactory' => function ( MediaWikiServices $services ) : MediaHandlerFactory {
616  return new MediaHandlerFactory(
617  $services->getMainConfig()->get( 'MediaHandlers' )
618  );
619  },
620 
621  'MergeHistoryFactory' => function ( MediaWikiServices $services ) : MergeHistoryFactory {
622  return $services->getService( '_PageCommandFactory' );
623  },
624 
625  'MessageCache' => function ( MediaWikiServices $services ) : MessageCache {
626  $mainConfig = $services->getMainConfig();
627  $clusterCache = ObjectCache::getInstance( $mainConfig->get( 'MessageCacheType' ) );
628  $srvCache = $mainConfig->get( 'UseLocalMessageCache' )
629  ? $services->getLocalServerObjectCache()
630  : new EmptyBagOStuff();
631 
632  $logger = LoggerFactory::getInstance( 'MessageCache' );
633  $logger->debug( 'MessageCache using store {class}', [
634  'class' => get_class( $clusterCache )
635  ] );
636 
637  return new MessageCache(
638  $services->getMainWANObjectCache(),
639  $clusterCache,
640  $srvCache,
641  $services->getContentLanguage(),
642  $services->getLanguageConverterFactory()->getLanguageConverter(),
643  $logger,
644  [ 'useDB' => $mainConfig->get( 'UseDatabaseMessages' ) ],
645  $services->getLanguageFactory(),
646  $services->getLocalisationCache(),
647  $services->getLanguageNameUtils(),
648  $services->getLanguageFallback()
649  );
650  },
651 
652  'MessageFormatterFactory' => function () : IMessageFormatterFactory {
653  return new MessageFormatterFactory();
654  },
655 
656  'MimeAnalyzer' => function ( MediaWikiServices $services ) : MimeAnalyzer {
657  $logger = LoggerFactory::getInstance( 'Mime' );
658  $mainConfig = $services->getMainConfig();
659  $params = [
660  'typeFile' => $mainConfig->get( 'MimeTypeFile' ),
661  'infoFile' => $mainConfig->get( 'MimeInfoFile' ),
662  'xmlTypes' => $mainConfig->get( 'XMLMimeTypes' ),
663  'guessCallback' =>
664  function ( $mimeAnalyzer, &$head, &$tail, $file, &$mime ) use ( $logger ) {
665  // Also test DjVu
666  $deja = new DjVuImage( $file );
667  if ( $deja->isValid() ) {
668  $logger->info( "Detected $file as image/vnd.djvu\n" );
669  $mime = 'image/vnd.djvu';
670 
671  return;
672  }
673  // Some strings by reference for performance - assuming well-behaved hooks
674  Hooks::run(
675  'MimeMagicGuessFromContent',
676  [ $mimeAnalyzer, &$head, &$tail, $file, &$mime ]
677  );
678  },
679  'extCallback' => function ( $mimeAnalyzer, $ext, &$mime ) {
680  // Media handling extensions can improve the MIME detected
681  Hooks::run( 'MimeMagicImproveFromExtension', [ $mimeAnalyzer, $ext, &$mime ] );
682  },
683  'initCallback' => function ( $mimeAnalyzer ) {
684  // Allow media handling extensions adding MIME-types and MIME-info
685  Hooks::run( 'MimeMagicInit', [ $mimeAnalyzer ] );
686  },
687  'logger' => $logger
688  ];
689 
690  if ( $params['infoFile'] === 'includes/mime.info' ) {
691  $params['infoFile'] = MimeAnalyzer::USE_INTERNAL;
692  }
693 
694  if ( $params['typeFile'] === 'includes/mime.types' ) {
695  $params['typeFile'] = MimeAnalyzer::USE_INTERNAL;
696  }
697 
698  $detectorCmd = $mainConfig->get( 'MimeDetectorCommand' );
699  if ( $detectorCmd ) {
700  $factory = $services->getShellCommandFactory();
701  $params['detectCallback'] = function ( $file ) use ( $detectorCmd, $factory ) {
702  $result = $factory->create()
703  // $wgMimeDetectorCommand can contain commands with parameters
704  ->unsafeParams( $detectorCmd )
705  ->params( $file )
706  ->execute();
707  return $result->getStdout();
708  };
709  }
710 
711  return new MimeAnalyzer( $params );
712  },
713 
714  'MovePageFactory' => function ( MediaWikiServices $services ) : MovePageFactory {
715  return $services->getService( '_PageCommandFactory' );
716  },
717 
718  'NamespaceInfo' => function ( MediaWikiServices $services ) : NamespaceInfo {
720  $services->getMainConfig() ) );
721  },
722 
723  'NameTableStoreFactory' => function ( MediaWikiServices $services ) : NameTableStoreFactory {
724  return new NameTableStoreFactory(
725  $services->getDBLoadBalancerFactory(),
726  $services->getMainWANObjectCache(),
727  LoggerFactory::getInstance( 'NameTableSqlStore' )
728  );
729  },
730 
731  'ObjectFactory' => function ( MediaWikiServices $services ) : ObjectFactory {
732  return new ObjectFactory( $services );
733  },
734 
735  'OldRevisionImporter' => function ( MediaWikiServices $services ) : OldRevisionImporter {
737  true,
738  LoggerFactory::getInstance( 'OldRevisionImporter' ),
739  $services->getDBLoadBalancer()
740  );
741  },
742 
743  'PageEditStash' => function ( MediaWikiServices $services ) : PageEditStash {
744  $config = $services->getMainConfig();
745 
746  return new PageEditStash(
748  $services->getDBLoadBalancer(),
749  LoggerFactory::getInstance( 'StashEdit' ),
750  $services->getStatsdDataFactory(),
751  defined( 'MEDIAWIKI_JOB_RUNNER' ) || $config->get( 'CommandLineMode' )
752  ? PageEditStash::INITIATOR_JOB_OR_CLI
753  : PageEditStash::INITIATOR_USER
754  );
755  },
756 
757  'Parser' => function ( MediaWikiServices $services ) : Parser {
758  return $services->getParserFactory()->create();
759  },
760 
761  'ParserCache' => function ( MediaWikiServices $services ) : ParserCache {
762  $config = $services->getMainConfig();
763  $cache = ObjectCache::getInstance( $config->get( 'ParserCacheType' ) );
764  wfDebugLog( 'caches', 'parser: ' . get_class( $cache ) );
765 
766  return new ParserCache(
767  $cache,
768  $config->get( 'CacheEpoch' )
769  );
770  },
771 
772  'ParserFactory' => function ( MediaWikiServices $services ) : ParserFactory {
773  $options = new ServiceOptions( Parser::CONSTRUCTOR_OPTIONS,
774  // 'class'
775  // Note that this value is ignored by ParserFactory and is always
776  // Parser::class for legacy reasons; we'll introduce a new
777  // mechanism for selecting an alternate parser in the future
778  // (T236809)
779  $services->getMainConfig()->get( 'ParserConf' ),
780  // Make sure to have defaults in case someone overrode ParserConf with something silly
781  [ 'class' => Parser::class ],
782  // Plus a buch of actual config options
783  $services->getMainConfig()
784  );
785 
786  return new ParserFactory(
787  $options,
788  $services->getMagicWordFactory(),
789  $services->getContentLanguage(),
790  wfUrlProtocols(),
791  $services->getSpecialPageFactory(),
792  $services->getLinkRendererFactory(),
793  $services->getNamespaceInfo(),
794  LoggerFactory::getInstance( 'Parser' ),
795  $services->getBadFileLookup(),
796  $services->getLanguageConverterFactory()
797  );
798  },
799 
800  'PasswordFactory' => function ( MediaWikiServices $services ) : PasswordFactory {
801  $config = $services->getMainConfig();
802  return new PasswordFactory(
803  $config->get( 'PasswordConfig' ),
804  $config->get( 'PasswordDefault' )
805  );
806  },
807 
808  'PasswordReset' => function ( MediaWikiServices $services ) : PasswordReset {
809  $options = new ServiceOptions( PasswordReset::CONSTRUCTOR_OPTIONS, $services->getMainConfig() );
810  return new PasswordReset(
811  $options,
812  AuthManager::singleton(),
813  $services->getPermissionManager(),
814  $services->getDBLoadBalancer(),
815  LoggerFactory::getInstance( 'authentication' )
816  );
817  },
818 
819  'PerDbNameStatsdDataFactory' =>
820  function ( MediaWikiServices $services ) : StatsdDataFactoryInterface {
821  $config = $services->getMainConfig();
822  $wiki = $config->get( 'DBname' );
824  $services->getStatsdDataFactory(),
825  $wiki
826  );
827  },
828 
829  'PermissionManager' => function ( MediaWikiServices $services ) : PermissionManager {
830  return new PermissionManager(
831  new ServiceOptions(
832  PermissionManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
833  ),
834  $services->getSpecialPageFactory(),
835  $services->getRevisionLookup(),
836  $services->getNamespaceInfo(),
837  $services->getBlockErrorFormatter()
838  );
839  },
840 
841  'PreferencesFactory' => function ( MediaWikiServices $services ) : PreferencesFactory {
842  $factory = new DefaultPreferencesFactory(
843  new ServiceOptions(
844  DefaultPreferencesFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
845  $services->getContentLanguage(),
846  AuthManager::singleton(),
847  $services->getLinkRendererFactory()->create(),
848  $services->getNamespaceInfo(),
849  $services->getPermissionManager(),
850  $services->getLanguageConverterFactory()->getLanguageConverter(),
851  $services->getLanguageNameUtils()
852  );
853  $factory->setLogger( LoggerFactory::getInstance( 'preferences' ) );
854 
855  return $factory;
856  },
857 
858  'ProxyLookup' => function ( MediaWikiServices $services ) : ProxyLookup {
859  $mainConfig = $services->getMainConfig();
860  return new ProxyLookup(
861  $mainConfig->get( 'CdnServers' ),
862  $mainConfig->get( 'CdnServersNoPurge' )
863  );
864  },
865 
866  'ReadOnlyMode' => function ( MediaWikiServices $services ) : ReadOnlyMode {
867  return new ReadOnlyMode(
868  $services->getConfiguredReadOnlyMode(),
869  $services->getDBLoadBalancer()
870  );
871  },
872 
873  'RepoGroup' => function ( MediaWikiServices $services ) : RepoGroup {
874  $config = $services->getMainConfig();
875  return new RepoGroup(
876  $config->get( 'LocalFileRepo' ),
877  $config->get( 'ForeignFileRepos' ),
878  $services->getMainWANObjectCache()
879  );
880  },
881 
882  'ResourceLoader' => function ( MediaWikiServices $services ) : ResourceLoader {
883  // @todo This should not take a Config object, but it's not so easy to remove because it
884  // exposes it in a getter, which is actually used.
885  global $IP;
886  $config = $services->getMainConfig();
887 
888  $rl = new ResourceLoader(
889  $config,
890  LoggerFactory::getInstance( 'resourceloader' ),
891  $config->get( 'ResourceLoaderUseObjectCacheForDeps' )
892  ? new KeyValueDependencyStore( $services->getMainObjectStash() )
893  : new SqlModuleDependencyStore( $services->getDBLoadBalancer() )
894  );
895 
896  $extRegistry = ExtensionRegistry::getInstance();
897  // Attribute has precedence over config
898  $modules = $extRegistry->getAttribute( 'ResourceModules' )
899  + $config->get( 'ResourceModules' );
900  $moduleSkinStyles = $extRegistry->getAttribute( 'ResourceModuleSkinStyles' )
901  + $config->get( 'ResourceModuleSkinStyles' );
902 
903  $rl->setModuleSkinStyles( $moduleSkinStyles );
904  $rl->addSource( $config->get( 'ResourceLoaderSources' ) );
905 
906  // Core modules, then extension/skin modules
907  $rl->register( include "$IP/resources/Resources.php" );
908  $rl->register( $modules );
909  Hooks::run( 'ResourceLoaderRegisterModules', [ &$rl ] );
910 
911  $msgPosterAttrib = $extRegistry->getAttribute( 'MessagePosterModule' );
912  $rl->register( 'mediawiki.messagePoster', [
913  'localBasePath' => '',
914  'debugRaw' => false,
915  'scripts' => array_merge(
916  [
917  "$IP/resources/src/mediawiki.messagePoster/factory.js",
918  "$IP/resources/src/mediawiki.messagePoster/MessagePoster.js",
919  "$IP/resources/src/mediawiki.messagePoster/WikitextMessagePoster.js",
920  ],
921  $msgPosterAttrib['scripts'] ?? []
922  ),
923  'dependencies' => array_merge(
924  [
925  'oojs',
926  'mediawiki.api',
927  'mediawiki.ForeignApi',
928  ],
929  $msgPosterAttrib['dependencies'] ?? []
930  ),
931  'targets' => [ 'desktop', 'mobile' ],
932  ] );
933 
934  if ( $config->get( 'EnableJavaScriptTest' ) === true ) {
935  $rl->registerTestModules();
936  }
937 
938  return $rl;
939  },
940 
941  'RevisionFactory' => function ( MediaWikiServices $services ) : RevisionFactory {
942  return $services->getRevisionStore();
943  },
944 
945  'RevisionLookup' => function ( MediaWikiServices $services ) : RevisionLookup {
946  return $services->getRevisionStore();
947  },
948 
949  'RevisionRenderer' => function ( MediaWikiServices $services ) : RevisionRenderer {
950  $renderer = new RevisionRenderer(
951  $services->getDBLoadBalancer(),
952  $services->getSlotRoleRegistry()
953  );
954 
955  $renderer->setLogger( LoggerFactory::getInstance( 'SaveParse' ) );
956  return $renderer;
957  },
958 
959  'RevisionStore' => function ( MediaWikiServices $services ) : RevisionStore {
960  return $services->getRevisionStoreFactory()->getRevisionStore();
961  },
962 
963  'RevisionStoreFactory' => function ( MediaWikiServices $services ) : RevisionStoreFactory {
964  $config = $services->getMainConfig();
965 
966  if ( $config->has( 'MultiContentRevisionSchemaMigrationStage' ) ) {
967  if ( $config->get( 'MultiContentRevisionSchemaMigrationStage' ) !== SCHEMA_COMPAT_NEW ) {
968  throw new UnexpectedValueException(
969  'The MultiContentRevisionSchemaMigrationStage setting is no longer supported!'
970  );
971  }
972  }
973 
974  $store = new RevisionStoreFactory(
975  $services->getDBLoadBalancerFactory(),
976  $services->getBlobStoreFactory(),
977  $services->getNameTableStoreFactory(),
978  $services->getSlotRoleRegistry(),
979  $services->getMainWANObjectCache(),
980  $services->getCommentStore(),
981  $services->getActorMigration(),
982  LoggerFactory::getInstance( 'RevisionStore' ),
983  $services->getContentHandlerFactory()
984  );
985 
986  return $store;
987  },
988 
989  'SearchEngineConfig' => function ( MediaWikiServices $services ) : SearchEngineConfig {
990  // @todo This should not take a Config object, but it's not so easy to remove because it
991  // exposes it in a getter, which is actually used.
992  return new SearchEngineConfig(
993  $services->getMainConfig(),
994  $services->getContentLanguage(),
995  ExtensionRegistry::getInstance()->getAttribute( 'SearchMappings' )
996  );
997  },
998 
999  'SearchEngineFactory' => function ( MediaWikiServices $services ) : SearchEngineFactory {
1000  return new SearchEngineFactory( $services->getSearchEngineConfig() );
1001  },
1002 
1003  'ShellCommandFactory' => function ( MediaWikiServices $services ) : CommandFactory {
1004  $config = $services->getMainConfig();
1005 
1006  $limits = [
1007  'time' => $config->get( 'MaxShellTime' ),
1008  'walltime' => $config->get( 'MaxShellWallClockTime' ),
1009  'memory' => $config->get( 'MaxShellMemory' ),
1010  'filesize' => $config->get( 'MaxShellFileSize' ),
1011  ];
1012  $cgroup = $config->get( 'ShellCgroup' );
1013  $restrictionMethod = $config->get( 'ShellRestrictionMethod' );
1014 
1015  $factory = new CommandFactory( $limits, $cgroup, $restrictionMethod );
1016  $factory->setLogger( LoggerFactory::getInstance( 'exec' ) );
1017  $factory->logStderr();
1018 
1019  return $factory;
1020  },
1021 
1022  'SiteLookup' => function ( MediaWikiServices $services ) : SiteLookup {
1023  // Use SiteStore as the SiteLookup as well. This was originally separated
1024  // to allow for a cacheable read-only interface, but this was never used.
1025  // SiteStore has caching (see below).
1026  return $services->getSiteStore();
1027  },
1028 
1029  'SiteStore' => function ( MediaWikiServices $services ) : SiteStore {
1030  $rawSiteStore = new DBSiteStore( $services->getDBLoadBalancer() );
1031 
1032  $cache = $services->getLocalServerObjectCache();
1033  if ( $cache instanceof EmptyBagOStuff ) {
1035  }
1036 
1037  return new CachingSiteStore( $rawSiteStore, $cache );
1038  },
1039 
1041  'SkinFactory' => function ( MediaWikiServices $services ) : SkinFactory {
1042  $factory = new SkinFactory( $services->getObjectFactory() );
1043 
1044  $names = $services->getMainConfig()->get( 'ValidSkinNames' );
1045 
1046  foreach ( $names as $name => $skin ) {
1047  if ( is_array( $skin ) ) {
1048  $spec = $skin;
1049  $displayName = $skin['displayname'] ?? $name;
1050  } else {
1051  $displayName = $skin;
1052  $spec = [
1053  'class' => "Skin$skin"
1054  ];
1055  }
1056  $factory->register( $name, $displayName, $spec );
1057  }
1058 
1059  // Register a hidden "fallback" skin
1060  $factory->register( 'fallback', 'Fallback', [
1061  'class' => SkinFallback::class
1062  ] );
1063  // Register a hidden skin for api output
1064  $factory->register( 'apioutput', 'ApiOutput', [
1065  'class' => SkinApi::class
1066  ] );
1067 
1068  return $factory;
1069  },
1070 
1071  'SlotRoleRegistry' => function ( MediaWikiServices $services ) : SlotRoleRegistry {
1072  $config = $services->getMainConfig();
1073  $contentHandlerFactory = $services->getContentHandlerFactory();
1074 
1075  $registry = new SlotRoleRegistry(
1076  $services->getNameTableStoreFactory()->getSlotRoles()
1077  );
1078 
1079  $registry->defineRole( 'main', function () use ( $config, $contentHandlerFactory ) {
1080  return new MainSlotRoleHandler(
1081  $config->get( 'NamespaceContentModels' ),
1082  $contentHandlerFactory
1083  );
1084  } );
1085 
1086  return $registry;
1087  },
1088 
1089  'SpamChecker' => function ( MediaWikiServices $services ) : SpamChecker {
1090  return new SpamChecker(
1091  (array)$services->getMainConfig()->get( 'SpamRegex' ),
1092  (array)$services->getMainConfig()->get( 'SummarySpamRegex' )
1093  );
1094  },
1095 
1096  'SpecialPageFactory' => function ( MediaWikiServices $services ) : SpecialPageFactory {
1097  return new SpecialPageFactory(
1098  new ServiceOptions(
1099  SpecialPageFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1100  $services->getContentLanguage(),
1101  $services->getObjectFactory()
1102  );
1103  },
1104 
1105  'StatsdDataFactory' => function ( MediaWikiServices $services ) : IBufferingStatsdDataFactory {
1106  return new BufferingStatsdDataFactory(
1107  rtrim( $services->getMainConfig()->get( 'StatsdMetricPrefix' ), '.' )
1108  );
1109  },
1110 
1111  'TalkPageNotificationManager' => function (
1112  MediaWikiServices $services
1114  return new TalkPageNotificationManager(
1115  new ServiceOptions(
1116  TalkPageNotificationManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1117  ),
1118  $services->getDBLoadBalancer(),
1119  $services->getReadOnlyMode(),
1120  $services->getRevisionLookup()
1121  );
1122  },
1123 
1124  'TempFSFileFactory' => function ( MediaWikiServices $services ) : TempFSFileFactory {
1125  return new TempFSFileFactory( $services->getMainConfig()->get( 'TmpDirectory' ) );
1126  },
1127 
1128  'TitleFactory' => function () : TitleFactory {
1129  return new TitleFactory();
1130  },
1131 
1132  'TitleFormatter' => function ( MediaWikiServices $services ) : TitleFormatter {
1133  return $services->getService( '_MediaWikiTitleCodec' );
1134  },
1135 
1136  'TitleParser' => function ( MediaWikiServices $services ) : TitleParser {
1137  return $services->getService( '_MediaWikiTitleCodec' );
1138  },
1139 
1140  'UploadRevisionImporter' => function ( MediaWikiServices $services ) : UploadRevisionImporter {
1142  $services->getMainConfig()->get( 'EnableUploads' ),
1143  LoggerFactory::getInstance( 'UploadRevisionImporter' )
1144  );
1145  },
1146 
1147  'UserNameUtils' => function ( MediaWikiServices $services ) : UserNameUtils {
1148  $messageFormatterFactory = new MessageFormatterFactory( Message::FORMAT_PLAIN );
1149  return new UserNameUtils(
1150  new ServiceOptions(
1151  UserNameUtils::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
1152  ),
1153  $services->getContentLanguage(),
1154  LoggerFactory::getInstance( 'UserNameUtils' ),
1155  $services->getService( 'TitleFactory' ),
1156  $messageFormatterFactory->getTextFormatter(
1157  $services->getContentLanguage()->getCode()
1158  )
1159  );
1160  },
1161 
1162  'UserOptionsLookup' => function ( MediaWikiServices $services ) : UserOptionsLookup {
1163  return $services->getUserOptionsManager();
1164  },
1165 
1166  'UserOptionsManager' => function ( MediaWikiServices $services ) : UserOptionsManager {
1167  return new UserOptionsManager(
1168  new ServiceOptions( UserOptionsManager::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1169  $services->get( '_DefaultOptionsLookup' ),
1170  $services->getLanguageConverterFactory(),
1171  $services->getDBLoadBalancer(),
1172  LoggerFactory::getInstance( 'UserOptionsManager' )
1173  );
1174  },
1175 
1176  'VirtualRESTServiceClient' =>
1177  function ( MediaWikiServices $services ) : VirtualRESTServiceClient {
1178  $config = $services->getMainConfig()->get( 'VirtualRestConfig' );
1179 
1180  $vrsClient = new VirtualRESTServiceClient( new MultiHttpClient( [] ) );
1181  foreach ( $config['paths'] as $prefix => $serviceConfig ) {
1182  $class = $serviceConfig['class'];
1183  // Merge in the global defaults
1184  $constructArg = $serviceConfig['options'] ?? [];
1185  $constructArg += $config['global'];
1186  // Make the VRS service available at the mount point
1187  $vrsClient->mount( $prefix, [ 'class' => $class, 'config' => $constructArg ] );
1188  }
1189 
1190  return $vrsClient;
1191  },
1192 
1193  'WatchedItemQueryService' =>
1194  function ( MediaWikiServices $services ) : WatchedItemQueryService {
1195  return new WatchedItemQueryService(
1196  $services->getDBLoadBalancer(),
1197  $services->getCommentStore(),
1198  $services->getActorMigration(),
1199  $services->getWatchedItemStore(),
1200  $services->getPermissionManager(),
1201  $services->getMainConfig()->get( 'WatchlistExpiry' )
1202  );
1203  },
1204 
1205  'WatchedItemStore' => function ( MediaWikiServices $services ) : WatchedItemStore {
1206  $store = new WatchedItemStore(
1207  $services->getDBLoadBalancerFactory(),
1209  $services->getMainObjectStash(),
1210  new HashBagOStuff( [ 'maxKeys' => 100 ] ),
1211  $services->getReadOnlyMode(),
1212  $services->getMainConfig()->get( 'UpdateRowsPerQuery' ),
1213  $services->getNamespaceInfo(),
1214  $services->getRevisionLookup(),
1215  $services->getMainConfig()->get( 'WatchlistExpiry' )
1216  );
1217  $store->setStatsdDataFactory( $services->getStatsdDataFactory() );
1218 
1219  if ( $services->getMainConfig()->get( 'ReadOnlyWatchedItemStore' ) ) {
1220  $store = new NoWriteWatchedItemStore( $store );
1221  }
1222 
1223  return $store;
1224  },
1225 
1226  'WikiRevisionOldRevisionImporterNoUpdates' =>
1227  function ( MediaWikiServices $services ) : ImportableOldRevisionImporter {
1228  return new ImportableOldRevisionImporter(
1229  false,
1230  LoggerFactory::getInstance( 'OldRevisionImporter' ),
1231  $services->getDBLoadBalancer()
1232  );
1233  },
1234 
1235  '_DefaultOptionsLookup' => function ( MediaWikiServices $services ) : DefaultOptionsLookup {
1236  return new DefaultOptionsLookup(
1237  new ServiceOptions( DefaultOptionsLookup::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1238  $services->getContentLanguage()
1239  );
1240  },
1241 
1242  '_MediaWikiTitleCodec' => function ( MediaWikiServices $services ) : MediaWikiTitleCodec {
1243  return new MediaWikiTitleCodec(
1244  $services->getContentLanguage(),
1245  $services->getGenderCache(),
1246  $services->getMainConfig()->get( 'LocalInterwikis' ),
1247  $services->getInterwikiLookup(),
1248  $services->getNamespaceInfo()
1249  );
1250  },
1251 
1252  '_PageCommandFactory' => function ( MediaWikiServices $services ) : PageCommandFactory {
1253  return new PageCommandFactory(
1254  new ServiceOptions( PageCommandFactory::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
1255  $services->getDBLoadBalancer(),
1256  $services->getNamespaceInfo(),
1257  $services->getWatchedItemStore(),
1258  $services->getPermissionManager(),
1259  $services->getRepoGroup(),
1260  $services->getContentHandlerFactory(),
1261  $services->getRevisionStore()
1262  );
1263  },
1264 
1265  '_SqlBlobStore' => function ( MediaWikiServices $services ) : SqlBlobStore {
1266  return $services->getBlobStoreFactory()->newSqlBlobStore();
1267  },
1268 
1270  // NOTE: When adding a service here, don't forget to add a getter function
1271  // in the MediaWikiServices class. The convenience getter should just call
1272  // $this->getService( 'FooBarService' ).
1274 
1275 ];
PasswordReset\CONSTRUCTOR_OPTIONS
const CONSTRUCTOR_OPTIONS
Definition: PasswordReset.php:63
EventRelayerGroup
Factory class for spawning EventRelayer objects using configuration.
Definition: EventRelayerGroup.php:26
LinkCache
Cache for article titles (prefixed DB keys) and ids linked from one source.
Definition: LinkCache.php:34
MultiHttpClient
Class to handle multiple HTTP requests.
Definition: MultiHttpClient.php:55
MediaWikiTitleCodec
A codec for MediaWiki page titles.
Definition: MediaWikiTitleCodec.php:39
WikiMap\getCurrentWikiDbDomain
static getCurrentWikiDbDomain()
Definition: WikiMap.php:293
UploadRevisionImporter
Definition: UploadRevisionImporter.php:6
Wikimedia\UUID\GlobalIdGenerator
Class for getting statistically unique IDs without a central coordinator.
Definition: GlobalIdGenerator.php:36
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:194
MagicWordFactory
A factory that stores information about MagicWords, and creates them on demand with caching.
Definition: MagicWordFactory.php:34
HashBagOStuff
Simple store for keeping values in an associative array for the current process.
Definition: HashBagOStuff.php:31
ImportableOldRevisionImporter
Definition: ImportableOldRevisionImporter.php:12
MediaWiki\Interwiki\ClassicInterwikiLookup
InterwikiLookup implementing the "classic" interwiki storage (hardcoded up to MW 1....
Definition: ClassicInterwikiLookup.php:47
EmptyBagOStuff
A BagOStuff object with no objects in it.
Definition: EmptyBagOStuff.php:29
Revision\MainSlotRoleHandler
A SlotRoleHandler for the main slot.
Definition: MainSlotRoleHandler.php:42
MediaWiki\Block\BlockManager
A service class for checking blocks.
Definition: BlockManager.php:45
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:144
MediaWiki\BadFileLookup
Definition: BadFileLookup.php:12
MimeAnalyzer
Implements functions related to MIME types such as detection and mapping to file extension.
Definition: MimeAnalyzer.php:33
Revision\RevisionStore
Service for looking up page revisions.
Definition: RevisionStore.php:78
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:51
MediaWiki\Block\BlockErrorFormatter
A service class for getting formatted information about a block.
Definition: BlockErrorFormatter.php:34
MediaWiki\Http\HttpRequestFactory
Factory creating MWHttpRequest objects.
Definition: HttpRequestFactory.php:38
MediaWiki\Languages\LanguageFactory
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: LanguageFactory.php:41
MediaWiki\Linker\LinkRenderer
Class that generates HTML links for pages.
Definition: LinkRenderer.php:42
MediaWiki\SpecialPage\SpecialPageFactory
Factory for handling the special page list and generating SpecialPage objects.
Definition: SpecialPageFactory.php:64
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
MIGRATION_NEW
const MIGRATION_NEW
Definition: Defines.php:307
MediaWiki\HookContainer\DeprecatedHooks
Definition: DeprecatedHooks.php:27
GenderCache
Caches user genders when needed to use correct namespace aliases.
Definition: GenderCache.php:35
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
CommentStore handles storage of comments (edit summaries, log reasons, etc) in the database.
Definition: CommentStore.php:31
$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:65
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition: GlobalFunctions.php:1198
MediaWiki\Linker\LinkRendererFactory
Factory to create LinkRender objects.
Definition: LinkRendererFactory.php:33
SearchEngineFactory
Factory class for SearchEngine.
Definition: SearchEngineFactory.php:12
Revision\RevisionFactory
Service for constructing revision objects.
Definition: RevisionFactory.php:38
ActorMigration
This class handles the logic for the actor table migration.
Definition: ActorMigration.php:38
MWLBFactory\setDomainAliases
static setDomainAliases(ILBFactory $lbFactory)
Definition: MWLBFactory.php:340
MediaWiki\Languages\LanguageConverterFactory
An interface for creating language converters.
Definition: LanguageConverterFactory.php:44
wfDebugLog
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
Definition: GlobalFunctions.php:992
SiteLookup
Definition: SiteLookup.php:28
Revision\RevisionLookup
Service for looking up page revisions.
Definition: RevisionLookup.php:38
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:29
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:41
SiteStore
Definition: SiteStore.php:29
MediaWiki\User\DefaultOptionsLookup
A service class to control default user options.
Definition: DefaultOptionsLookup.php:34
ExtensionRegistry\getInstance
static getInstance()
Definition: ExtensionRegistry.php:130
WANObjectCache\newEmpty
static newEmpty()
Get an instance that wraps EmptyBagOStuff.
Definition: WANObjectCache.php:348
Config
Interface for configuration instances.
Definition: Config.php:28
ObjectCache\newFromParams
static newFromParams(array $params, Config $conf=null)
Create a new cache object from parameters.
Definition: ObjectCache.php:143
Page\MergeHistoryFactory
Definition: MergeHistoryFactory.php:31
BagOStuff\get
get( $key, $flags=0)
Get an item with the given key.
WANObjectCache\get
get( $key, &$curTTL=null, array $checkKeys=[], &$info=null)
Fetch the value of a key from cache.
Definition: WANObjectCache.php:402
MediaWiki\Config\ServiceOptions
A class for passing options to services.
Definition: ServiceOptions.php:25
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:44
DateFormatterFactory
Definition: DateFormatterFactory.php:3
LocalisationCache\getStoreFromConf
static getStoreFromConf(array $conf, $fallbackCacheDir)
Return a suitable LCStore as specified by the given configuration.
Definition: LocalisationCache.php:202
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:38
MWLBFactory\applyDefaultConfig
static applyDefaultConfig(array $lbConf, ServiceOptions $options, ConfiguredReadOnlyMode $readOnlyMode, BagOStuff $srvCache, BagOStuff $mainStash, WANObjectCache $wanCache)
Definition: MWLBFactory.php:73
WatchedItemQueryService
Definition: WatchedItemQueryService.php:21
ProxyLookup
Definition: ProxyLookup.php:27
VirtualRESTServiceClient
Virtual HTTP service client loosely styled after a Virtual File System.
Definition: VirtualRESTServiceClient.php:45
$modules
$modules
Definition: HTMLFormElement.php:13
MediaWiki\Interwiki\InterwikiLookup
Service interface for looking up Interwiki records.
Definition: InterwikiLookup.php:32
MediaWiki\Content\ContentHandlerFactory
Definition: ContentHandlerFactory.php:42
ObjectCache\getInstance
static getInstance( $id)
Get a cached instance of the specified type of cache object.
Definition: ObjectCache.php:78
BufferingStatsdDataFactory
A factory for application metric data.
Definition: BufferingStatsdDataFactory.php:35
MWLBFactory\getLBFactoryClass
static getLBFactoryClass(array $config)
Returns the LBFactory class to use and the load balancer configuration.
Definition: MWLBFactory.php:304
DBSiteStore
Definition: DBSiteStore.php:33
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:84
FileBackendGroup\CONSTRUCTOR_OPTIONS
const CONSTRUCTOR_OPTIONS
Definition: FileBackendGroup.php:68
JobRunner\CONSTRUCTOR_OPTIONS
const CONSTRUCTOR_OPTIONS
Definition: JobRunner.php:43
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:719
ExternalStoreFactory
Definition: ExternalStoreFactory.php:15
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:48
ParserFactory
Definition: ParserFactory.php:32
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\EditPage\SpamChecker
Service to check if text (either content or a summary) qualifies as spam.
Definition: SpamChecker.php:14
MediaWiki\Shell\CommandFactory
Factory facilitating dependency injection for Command.
Definition: CommandFactory.php:32
MediaWiki\Preferences\PreferencesFactory
A PreferencesFactory is a MediaWiki service that provides the definitions of preferences for a given ...
Definition: PreferencesFactory.php:52
WANObjectCache
Multi-datacenter aware caching interface.
Definition: WANObjectCache.php:120
HtmlCacheUpdater
Class to invalidate the CDN and HTMLFileCache entries associated with URLs/titles.
Definition: HtmlCacheUpdater.php:27
LocalisationCache
Class for caching the contents of localisation files, Messages*.php and *.i18n.php.
Definition: LocalisationCache.php:41
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
Parser
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
Definition: Parser.php:79
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:451
Revision\RevisionStoreFactory
Factory service for RevisionStore instances.
Definition: RevisionStoreFactory.php:50
MediaWiki\User\UserOptionsLookup
Provides access to user options.
Definition: UserOptionsLookup.php:27
Page\MovePageFactory
Definition: MovePageFactory.php:30
MediaWiki\Auth\AuthManager
This serves as the entry point to the authentication system.
Definition: AuthManager.php:86
MediaWiki\Storage\BlobStore
Service for loading and storing data blobs.
Definition: BlobStore.php:35
$context
$context
Definition: load.php:43
MediaWiki\User\UserOptionsManager
A service class to control user options.
Definition: UserOptionsManager.php:43
WatchedItemStore
Storage layer class for WatchedItems.
Definition: WatchedItemStore.php:23
Page\PageCommandFactory
Common factory to construct page handling classes.
Definition: PageCommandFactory.php:42
IBufferingStatsdDataFactory
MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.
Definition: IBufferingStatsdDataFactory.php:11
Wikimedia\Services\RecursiveServiceDependencyException
Exception thrown when trying to instantiate a currently instantiating service.
Definition: RecursiveServiceDependencyException.php:34
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:54
OldRevisionImporter
Definition: OldRevisionImporter.php:6
JobQueueGroup\singleton
static singleton( $domain=false)
Definition: JobQueueGroup.php:70
$cache
$cache
Definition: mcc.php:33
MediaWiki\User\UserNameUtils
UserNameUtils service.
Definition: UserNameUtils.php:40
SCHEMA_COMPAT_NEW
const SCHEMA_COMPAT_NEW
Definition: Defines.php:280
TitleFormatter
A title formatter service for MediaWiki.
Definition: TitleFormatter.php:34
TitleFactory
Creates Title objects.
Definition: TitleFactory.php:33
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:31
ParserCache
Definition: ParserCache.php:30
ConfigFactory
Factory class to create Config objects.
Definition: ConfigFactory.php:31
MediaWiki\Preferences\DefaultPreferencesFactory
This is the default implementation of PreferencesFactory.
Definition: DefaultPreferencesFactory.php:64
MediaWiki\Storage\NameTableStoreFactory
Definition: NameTableStoreFactory.php:26
SearchEngineConfig
Configuration handling class for SearchEngine.
Definition: SearchEngineConfig.php:9
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:84
MediaWiki\HookContainer\HookContainer
HookContainer class.
Definition: HookContainer.php:39
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:1051
NamespaceInfo
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Definition: NamespaceInfo.php:33
MediumSpecificBagOStuff\get
get( $key, $flags=0)
Get an item with the given key.
Definition: MediumSpecificBagOStuff.php:112
$mime
$mime
Definition: router.php:60
JobRunner
Job queue runner utility methods.
Definition: JobRunner.php:41
MessageCache
Cache of messages that are defined by MediaWiki namespace pages or by hooks.
Definition: MessageCache.php:47
$IP
$IP
Definition: WebStart.php:49
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:133
Message\FORMAT_PLAIN
const FORMAT_PLAIN
Use message text as-is.
Definition: Message.php:162
PasswordReset
Helper class for the password reset functionality shared by the web UI and the API.
Definition: PasswordReset.php:41
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:39
NoWriteWatchedItemStore
Definition: NoWriteWatchedItemStore.php:30
MediaWiki\Block\BlockRestrictionStore
Definition: BlockRestrictionStore.php:34
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:2054