MediaWiki  1.33.0
ServiceWiring.php
Go to the documentation of this file.
1 <?php
40 use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
66 
67 return [
68  'ActorMigration' => function ( MediaWikiServices $services ) : ActorMigration {
69  return new ActorMigration(
70  $services->getMainConfig()->get( 'ActorTableSchemaMigrationStage' )
71  );
72  },
73 
74  'BlobStore' => function ( MediaWikiServices $services ) : BlobStore {
75  return $services->getService( '_SqlBlobStore' );
76  },
77 
78  'BlobStoreFactory' => function ( MediaWikiServices $services ) : BlobStoreFactory {
79  return new BlobStoreFactory(
80  $services->getDBLoadBalancerFactory(),
81  $services->getMainWANObjectCache(),
82  $services->getMainConfig(),
83  $services->getContentLanguage()
84  );
85  },
86 
87  'BlockRestrictionStore' => function ( MediaWikiServices $services ) : BlockRestrictionStore {
88  return new BlockRestrictionStore(
89  $services->getDBLoadBalancer()
90  );
91  },
92 
93  'CommentStore' => function ( MediaWikiServices $services ) : CommentStore {
94  return new CommentStore(
95  $services->getContentLanguage(),
97  );
98  },
99 
100  'ConfigFactory' => function ( MediaWikiServices $services ) : ConfigFactory {
101  // Use the bootstrap config to initialize the ConfigFactory.
102  $registry = $services->getBootstrapConfig()->get( 'ConfigRegistry' );
103  $factory = new ConfigFactory();
104 
105  foreach ( $registry as $name => $callback ) {
106  $factory->register( $name, $callback );
107  }
108  return $factory;
109  },
110 
111  'ConfigRepository' => function ( MediaWikiServices $services ) : ConfigRepository {
112  return new ConfigRepository( $services->getConfigFactory() );
113  },
114 
115  'ConfiguredReadOnlyMode' => function ( MediaWikiServices $services ) : ConfiguredReadOnlyMode {
116  return new ConfiguredReadOnlyMode( $services->getMainConfig() );
117  },
118 
119  'ContentLanguage' => function ( MediaWikiServices $services ) : Language {
120  return Language::factory( $services->getMainConfig()->get( 'LanguageCode' ) );
121  },
122 
123  'CryptHKDF' => function ( MediaWikiServices $services ) : CryptHKDF {
124  $config = $services->getMainConfig();
125 
126  $secret = $config->get( 'HKDFSecret' ) ?: $config->get( 'SecretKey' );
127  if ( !$secret ) {
128  throw new RuntimeException( "Cannot use MWCryptHKDF without a secret." );
129  }
130 
131  // In HKDF, the context can be known to the attacker, but this will
132  // keep simultaneous runs from producing the same output.
133  $context = [ microtime(), getmypid(), gethostname() ];
134 
135  // Setup salt cache. Use APC, or fallback to the main cache if it isn't setup
136  $cache = $services->getLocalServerObjectCache();
137  if ( $cache instanceof EmptyBagOStuff ) {
139  }
140 
141  return new CryptHKDF( $secret, $config->get( 'HKDFAlgorithm' ), $cache, $context );
142  },
143 
144  'CryptRand' => function () : CryptRand {
145  return new CryptRand();
146  },
147 
148  'DBLoadBalancer' => function ( MediaWikiServices $services ) : Wikimedia\Rdbms\LoadBalancer {
149  // just return the default LB from the DBLoadBalancerFactory service
150  return $services->getDBLoadBalancerFactory()->getMainLB();
151  },
152 
153  'DBLoadBalancerFactory' =>
154  function ( MediaWikiServices $services ) : Wikimedia\Rdbms\LBFactory {
155  $mainConfig = $services->getMainConfig();
156 
158  $mainConfig->get( 'LBFactoryConf' ),
159  $mainConfig,
160  $services->getConfiguredReadOnlyMode(),
161  $services->getLocalServerObjectCache(),
162  $services->getMainObjectStash(),
163  $services->getMainWANObjectCache()
164  );
165  $class = MWLBFactory::getLBFactoryClass( $lbConf );
166 
167  $instance = new $class( $lbConf );
168  MWLBFactory::setSchemaAliases( $instance, $mainConfig );
169 
170  return $instance;
171  },
172 
173  'EventRelayerGroup' => function ( MediaWikiServices $services ) : EventRelayerGroup {
174  return new EventRelayerGroup( $services->getMainConfig()->get( 'EventRelayerConfig' ) );
175  },
176 
177  'ExternalStoreFactory' => function ( MediaWikiServices $services ) : ExternalStoreFactory {
178  $config = $services->getMainConfig();
179 
180  return new ExternalStoreFactory(
181  $config->get( 'ExternalStores' )
182  );
183  },
184 
185  'GenderCache' => function ( MediaWikiServices $services ) : GenderCache {
186  return new GenderCache();
187  },
188 
189  'HttpRequestFactory' =>
190  function ( MediaWikiServices $services ) : \MediaWiki\Http\HttpRequestFactory {
191  return new \MediaWiki\Http\HttpRequestFactory();
192  },
193 
194  'InterwikiLookup' => function ( MediaWikiServices $services ) : InterwikiLookup {
195  $config = $services->getMainConfig();
196  return new ClassicInterwikiLookup(
197  $services->getContentLanguage(),
198  $services->getMainWANObjectCache(),
199  $config->get( 'InterwikiExpiry' ),
200  $config->get( 'InterwikiCache' ),
201  $config->get( 'InterwikiScopes' ),
202  $config->get( 'InterwikiFallbackSite' )
203  );
204  },
205 
206  'LinkCache' => function ( MediaWikiServices $services ) : LinkCache {
207  return new LinkCache(
208  $services->getTitleFormatter(),
209  $services->getMainWANObjectCache()
210  );
211  },
212 
213  'LinkRenderer' => function ( MediaWikiServices $services ) : LinkRenderer {
214  if ( defined( 'MW_NO_SESSION' ) ) {
215  return $services->getLinkRendererFactory()->create();
216  } else {
217  return $services->getLinkRendererFactory()->createForUser(
218  RequestContext::getMain()->getUser()
219  );
220  }
221  },
222 
223  'LinkRendererFactory' => function ( MediaWikiServices $services ) : LinkRendererFactory {
224  return new LinkRendererFactory(
225  $services->getTitleFormatter(),
226  $services->getLinkCache()
227  );
228  },
229 
230  'LocalServerObjectCache' => function ( MediaWikiServices $services ) : BagOStuff {
232  return \ObjectCache::newFromId( $cacheId );
233  },
234 
235  'MagicWordFactory' => function ( MediaWikiServices $services ) : MagicWordFactory {
236  return new MagicWordFactory( $services->getContentLanguage() );
237  },
238 
239  'MainConfig' => function ( MediaWikiServices $services ) : Config {
240  // Use the 'main' config from the ConfigFactory service.
241  return $services->getConfigFactory()->makeConfig( 'main' );
242  },
243 
244  'MainObjectStash' => function ( MediaWikiServices $services ) : BagOStuff {
245  $mainConfig = $services->getMainConfig();
246 
247  $id = $mainConfig->get( 'MainStash' );
248  if ( !isset( $mainConfig->get( 'ObjectCaches' )[$id] ) ) {
249  throw new UnexpectedValueException(
250  "Cache type \"$id\" is not present in \$wgObjectCaches." );
251  }
252 
253  return \ObjectCache::newFromParams( $mainConfig->get( 'ObjectCaches' )[$id] );
254  },
255 
256  'MainWANObjectCache' => function ( MediaWikiServices $services ) : WANObjectCache {
257  $mainConfig = $services->getMainConfig();
258 
259  $id = $mainConfig->get( 'MainWANCache' );
260  if ( !isset( $mainConfig->get( 'WANObjectCaches' )[$id] ) ) {
261  throw new UnexpectedValueException(
262  "WAN cache type \"$id\" is not present in \$wgWANObjectCaches." );
263  }
264 
265  $params = $mainConfig->get( 'WANObjectCaches' )[$id];
266  $objectCacheId = $params['cacheId'];
267  if ( !isset( $mainConfig->get( 'ObjectCaches' )[$objectCacheId] ) ) {
268  throw new UnexpectedValueException(
269  "Cache type \"$objectCacheId\" is not present in \$wgObjectCaches." );
270  }
271  $params['store'] = $mainConfig->get( 'ObjectCaches' )[$objectCacheId];
272 
273  return \ObjectCache::newWANCacheFromParams( $params );
274  },
275 
276  'MediaHandlerFactory' => function ( MediaWikiServices $services ) : MediaHandlerFactory {
277  return new MediaHandlerFactory(
278  $services->getMainConfig()->get( 'MediaHandlers' )
279  );
280  },
281 
282  'MimeAnalyzer' => function ( MediaWikiServices $services ) : MimeAnalyzer {
283  $logger = LoggerFactory::getInstance( 'Mime' );
284  $mainConfig = $services->getMainConfig();
285  $params = [
286  'typeFile' => $mainConfig->get( 'MimeTypeFile' ),
287  'infoFile' => $mainConfig->get( 'MimeInfoFile' ),
288  'xmlTypes' => $mainConfig->get( 'XMLMimeTypes' ),
289  'guessCallback' =>
290  function ( $mimeAnalyzer, &$head, &$tail, $file, &$mime ) use ( $logger ) {
291  // Also test DjVu
292  $deja = new DjVuImage( $file );
293  if ( $deja->isValid() ) {
294  $logger->info( "Detected $file as image/vnd.djvu\n" );
295  $mime = 'image/vnd.djvu';
296 
297  return;
298  }
299  // Some strings by reference for performance - assuming well-behaved hooks
300  Hooks::run(
301  'MimeMagicGuessFromContent',
302  [ $mimeAnalyzer, &$head, &$tail, $file, &$mime ]
303  );
304  },
305  'extCallback' => function ( $mimeAnalyzer, $ext, &$mime ) {
306  // Media handling extensions can improve the MIME detected
307  Hooks::run( 'MimeMagicImproveFromExtension', [ $mimeAnalyzer, $ext, &$mime ] );
308  },
309  'initCallback' => function ( $mimeAnalyzer ) {
310  // Allow media handling extensions adding MIME-types and MIME-info
311  Hooks::run( 'MimeMagicInit', [ $mimeAnalyzer ] );
312  },
313  'logger' => $logger
314  ];
315 
316  if ( $params['infoFile'] === 'includes/mime.info' ) {
317  $params['infoFile'] = __DIR__ . "/libs/mime/mime.info";
318  }
319 
320  if ( $params['typeFile'] === 'includes/mime.types' ) {
321  $params['typeFile'] = __DIR__ . "/libs/mime/mime.types";
322  }
323 
324  $detectorCmd = $mainConfig->get( 'MimeDetectorCommand' );
325  if ( $detectorCmd ) {
326  $factory = $services->getShellCommandFactory();
327  $params['detectCallback'] = function ( $file ) use ( $detectorCmd, $factory ) {
328  $result = $factory->create()
329  // $wgMimeDetectorCommand can contain commands with parameters
330  ->unsafeParams( $detectorCmd )
331  ->params( $file )
332  ->execute();
333  return $result->getStdout();
334  };
335  }
336 
337  return new MimeAnalyzer( $params );
338  },
339 
340  'NameTableStoreFactory' => function ( MediaWikiServices $services ) : NameTableStoreFactory {
341  return new NameTableStoreFactory(
342  $services->getDBLoadBalancerFactory(),
343  $services->getMainWANObjectCache(),
344  LoggerFactory::getInstance( 'NameTableSqlStore' )
345  );
346  },
347 
348  'OldRevisionImporter' => function ( MediaWikiServices $services ) : OldRevisionImporter {
350  true,
351  LoggerFactory::getInstance( 'OldRevisionImporter' ),
352  $services->getDBLoadBalancer()
353  );
354  },
355 
356  'Parser' => function ( MediaWikiServices $services ) : Parser {
357  return $services->getParserFactory()->create();
358  },
359 
360  'ParserCache' => function ( MediaWikiServices $services ) : ParserCache {
361  $config = $services->getMainConfig();
362  $cache = ObjectCache::getInstance( $config->get( 'ParserCacheType' ) );
363  wfDebugLog( 'caches', 'parser: ' . get_class( $cache ) );
364 
365  return new ParserCache(
366  $cache,
367  $config->get( 'CacheEpoch' )
368  );
369  },
370 
371  'ParserFactory' => function ( MediaWikiServices $services ) : ParserFactory {
372  return new ParserFactory(
373  $services->getMainConfig()->get( 'ParserConf' ),
374  $services->getMagicWordFactory(),
375  $services->getContentLanguage(),
376  wfUrlProtocols(),
377  $services->getSpecialPageFactory(),
378  $services->getMainConfig(),
379  $services->getLinkRendererFactory()
380  );
381  },
382 
383  'PasswordFactory' => function ( MediaWikiServices $services ) : PasswordFactory {
384  $config = $services->getMainConfig();
385  return new PasswordFactory(
386  $config->get( 'PasswordConfig' ),
387  $config->get( 'PasswordDefault' )
388  );
389  },
390 
391  'PerDbNameStatsdDataFactory' =>
392  function ( MediaWikiServices $services ) : StatsdDataFactoryInterface {
393  $config = $services->getMainConfig();
394  $wiki = $config->get( 'DBname' );
396  $services->getStatsdDataFactory(),
397  $wiki
398  );
399  },
400 
401  'PermissionManager' => function ( MediaWikiServices $services ) : PermissionManager {
402  $config = $services->getMainConfig();
403  return new PermissionManager(
404  $services->getSpecialPageFactory(),
405  $config->get( 'WhitelistRead' ),
406  $config->get( 'WhitelistReadRegexp' ),
407  $config->get( 'EmailConfirmToEdit' ),
408  $config->get( 'BlockDisablesLogin' ) );
409  },
410 
411  'PreferencesFactory' => function ( MediaWikiServices $services ) : PreferencesFactory {
412  $factory = new DefaultPreferencesFactory(
413  $services->getMainConfig(),
414  $services->getContentLanguage(),
415  AuthManager::singleton(),
416  $services->getLinkRendererFactory()->create()
417  );
418  $factory->setLogger( LoggerFactory::getInstance( 'preferences' ) );
419 
420  return $factory;
421  },
422 
423  'ProxyLookup' => function ( MediaWikiServices $services ) : ProxyLookup {
424  $mainConfig = $services->getMainConfig();
425  return new ProxyLookup(
426  $mainConfig->get( 'SquidServers' ),
427  $mainConfig->get( 'SquidServersNoPurge' )
428  );
429  },
430 
431  'ReadOnlyMode' => function ( MediaWikiServices $services ) : ReadOnlyMode {
432  return new ReadOnlyMode(
433  $services->getConfiguredReadOnlyMode(),
434  $services->getDBLoadBalancer()
435  );
436  },
437 
438  'ResourceLoader' => function ( MediaWikiServices $services ) : ResourceLoader {
439  global $IP;
440  $config = $services->getMainConfig();
441 
442  $rl = new ResourceLoader(
443  $config,
444  LoggerFactory::getInstance( 'resourceloader' )
445  );
446  $rl->addSource( $config->get( 'ResourceLoaderSources' ) );
447  $rl->register( include "$IP/resources/Resources.php" );
448 
449  return $rl;
450  },
451 
452  'RevisionFactory' => function ( MediaWikiServices $services ) : RevisionFactory {
453  return $services->getRevisionStore();
454  },
455 
456  'RevisionLookup' => function ( MediaWikiServices $services ) : RevisionLookup {
457  return $services->getRevisionStore();
458  },
459 
460  'RevisionRenderer' => function ( MediaWikiServices $services ) : RevisionRenderer {
461  $renderer = new RevisionRenderer(
462  $services->getDBLoadBalancer(),
463  $services->getSlotRoleRegistry()
464  );
465 
466  $renderer->setLogger( LoggerFactory::getInstance( 'SaveParse' ) );
467  return $renderer;
468  },
469 
470  'RevisionStore' => function ( MediaWikiServices $services ) : RevisionStore {
471  return $services->getRevisionStoreFactory()->getRevisionStore();
472  },
473 
474  'RevisionStoreFactory' => function ( MediaWikiServices $services ) : RevisionStoreFactory {
475  $config = $services->getMainConfig();
476  $store = new RevisionStoreFactory(
477  $services->getDBLoadBalancerFactory(),
478  $services->getBlobStoreFactory(),
479  $services->getNameTableStoreFactory(),
480  $services->getSlotRoleRegistry(),
481  $services->getMainWANObjectCache(),
482  $services->getCommentStore(),
483  $services->getActorMigration(),
484  $config->get( 'MultiContentRevisionSchemaMigrationStage' ),
485  LoggerFactory::getProvider(),
486  $config->get( 'ContentHandlerUseDB' )
487  );
488 
489  return $store;
490  },
491 
492  'SearchEngineConfig' => function ( MediaWikiServices $services ) : SearchEngineConfig {
493  return new SearchEngineConfig( $services->getMainConfig(),
494  $services->getContentLanguage() );
495  },
496 
497  'SearchEngineFactory' => function ( MediaWikiServices $services ) : SearchEngineFactory {
498  return new SearchEngineFactory( $services->getSearchEngineConfig() );
499  },
500 
501  'ShellCommandFactory' => function ( MediaWikiServices $services ) : CommandFactory {
502  $config = $services->getMainConfig();
503 
504  $limits = [
505  'time' => $config->get( 'MaxShellTime' ),
506  'walltime' => $config->get( 'MaxShellWallClockTime' ),
507  'memory' => $config->get( 'MaxShellMemory' ),
508  'filesize' => $config->get( 'MaxShellFileSize' ),
509  ];
510  $cgroup = $config->get( 'ShellCgroup' );
511  $restrictionMethod = $config->get( 'ShellRestrictionMethod' );
512 
513  $factory = new CommandFactory( $limits, $cgroup, $restrictionMethod );
514  $factory->setLogger( LoggerFactory::getInstance( 'exec' ) );
515  $factory->logStderr();
516 
517  return $factory;
518  },
519 
520  'SiteLookup' => function ( MediaWikiServices $services ) : SiteLookup {
521  // Use SiteStore as the SiteLookup as well. This was originally separated
522  // to allow for a cacheable read-only interface (using FileBasedSiteLookup),
523  // but this was never used. SiteStore has caching (see below).
524  return $services->getSiteStore();
525  },
526 
527  'SiteStore' => function ( MediaWikiServices $services ) : SiteStore {
528  $rawSiteStore = new DBSiteStore( $services->getDBLoadBalancer() );
529 
530  // TODO: replace wfGetCache with a CacheFactory service.
531  // TODO: replace wfIsHHVM with a capabilities service.
533 
534  return new CachingSiteStore( $rawSiteStore, $cache );
535  },
536 
537  'SkinFactory' => function ( MediaWikiServices $services ) : SkinFactory {
538  $factory = new SkinFactory();
539 
540  $names = $services->getMainConfig()->get( 'ValidSkinNames' );
541 
542  foreach ( $names as $name => $skin ) {
543  $factory->register( $name, $skin, function () use ( $name, $skin ) {
544  $class = "Skin$skin";
545  return new $class( $name );
546  } );
547  }
548  // Register a hidden "fallback" skin
549  $factory->register( 'fallback', 'Fallback', function () {
550  return new SkinFallback;
551  } );
552  // Register a hidden skin for api output
553  $factory->register( 'apioutput', 'ApiOutput', function () {
554  return new SkinApi;
555  } );
556 
557  return $factory;
558  },
559 
560  'SlotRoleRegistry' => function ( MediaWikiServices $services ) : SlotRoleRegistry {
561  $config = $services->getMainConfig();
562 
563  $registry = new SlotRoleRegistry(
564  $services->getNameTableStoreFactory()->getSlotRoles()
565  );
566 
567  $registry->defineRole( 'main', function () use ( $config ) {
568  return new MainSlotRoleHandler(
569  $config->get( 'NamespaceContentModels' )
570  );
571  } );
572 
573  return $registry;
574  },
575 
576  'SpecialPageFactory' => function ( MediaWikiServices $services ) : SpecialPageFactory {
577  return new SpecialPageFactory(
578  $services->getMainConfig(),
579  $services->getContentLanguage()
580  );
581  },
582 
583  'StatsdDataFactory' => function ( MediaWikiServices $services ) : IBufferingStatsdDataFactory {
584  return new BufferingStatsdDataFactory(
585  rtrim( $services->getMainConfig()->get( 'StatsdMetricPrefix' ), '.' )
586  );
587  },
588 
589  'TitleFormatter' => function ( MediaWikiServices $services ) : TitleFormatter {
590  return $services->getService( '_MediaWikiTitleCodec' );
591  },
592 
593  'TitleParser' => function ( MediaWikiServices $services ) : TitleParser {
594  return $services->getService( '_MediaWikiTitleCodec' );
595  },
596 
597  'UploadRevisionImporter' => function ( MediaWikiServices $services ) : UploadRevisionImporter {
599  $services->getMainConfig()->get( 'EnableUploads' ),
600  LoggerFactory::getInstance( 'UploadRevisionImporter' )
601  );
602  },
603 
604  'VirtualRESTServiceClient' =>
606  $config = $services->getMainConfig()->get( 'VirtualRestConfig' );
607 
608  $vrsClient = new VirtualRESTServiceClient( new MultiHttpClient( [] ) );
609  foreach ( $config['paths'] as $prefix => $serviceConfig ) {
610  $class = $serviceConfig['class'];
611  // Merge in the global defaults
612  $constructArg = $serviceConfig['options'] ?? [];
613  $constructArg += $config['global'];
614  // Make the VRS service available at the mount point
615  $vrsClient->mount( $prefix, [ 'class' => $class, 'config' => $constructArg ] );
616  }
617 
618  return $vrsClient;
619  },
620 
621  'WatchedItemQueryService' =>
623  return new WatchedItemQueryService(
624  $services->getDBLoadBalancer(),
625  $services->getCommentStore(),
626  $services->getActorMigration(),
627  $services->getWatchedItemStore()
628  );
629  },
630 
631  'WatchedItemStore' => function ( MediaWikiServices $services ) : WatchedItemStore {
632  $store = new WatchedItemStore(
633  $services->getDBLoadBalancerFactory(),
635  $services->getMainObjectStash(),
636  new HashBagOStuff( [ 'maxKeys' => 100 ] ),
637  $services->getReadOnlyMode(),
638  $services->getMainConfig()->get( 'UpdateRowsPerQuery' )
639  );
640  $store->setStatsdDataFactory( $services->getStatsdDataFactory() );
641 
642  if ( $services->getMainConfig()->get( 'ReadOnlyWatchedItemStore' ) ) {
643  $store = new NoWriteWatchedItemStore( $store );
644  }
645 
646  return $store;
647  },
648 
649  'WikiRevisionOldRevisionImporterNoUpdates' =>
652  false,
653  LoggerFactory::getInstance( 'OldRevisionImporter' ),
654  $services->getDBLoadBalancer()
655  );
656  },
657 
658  '_MediaWikiTitleCodec' => function ( MediaWikiServices $services ) : MediaWikiTitleCodec {
659  return new MediaWikiTitleCodec(
660  $services->getContentLanguage(),
661  $services->getGenderCache(),
662  $services->getMainConfig()->get( 'LocalInterwikis' ),
663  $services->getInterwikiLookup()
664  );
665  },
666 
667  '_SqlBlobStore' => function ( MediaWikiServices $services ) : SqlBlobStore {
668  return $services->getBlobStoreFactory()->newSqlBlobStore();
669  },
670 
672  // NOTE: When adding a service here, don't forget to add a getter function
673  // in the MediaWikiServices class. The convenience getter should just call
674  // $this->getService( 'FooBarService' ).
676 
677 ];
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:52
MediaWikiTitleCodec
A codec for MediaWiki page titles.
Definition: MediaWikiTitleCodec.php:38
$file
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Definition: router.php:42
UploadRevisionImporter
Definition: UploadRevisionImporter.php:6
ObjectCache\getLocalClusterInstance
static getLocalClusterInstance()
Get the main cluster-local cache object.
Definition: ObjectCache.php:356
SkinApi
SkinTemplate class for API output.
Definition: SkinApi.php:31
MagicWordFactory
A factory that stores information about MagicWords, and creates them on demand with caching.
Definition: MagicWordFactory.php:34
$context
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Definition: hooks.txt:2636
HashBagOStuff
Simple store for keeping values in an associative array for the current process.
Definition: HashBagOStuff.php:31
ImportableOldRevisionImporter
Definition: ImportableOldRevisionImporter.php:9
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:41
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:103
MimeAnalyzer
Implements functions related to MIME types such as detection and mapping to file extension.
Definition: MimeAnalyzer.php:30
Revision\RevisionStore
Service for looking up page revisions.
Definition: RevisionStore.php:76
MediaWiki\Storage\SqlBlobStore
Service for storing and loading Content objects.
Definition: SqlBlobStore.php:49
ObjectCache\detectLocalServerCache
static detectLocalServerCache()
Detects which local server cache library is present and returns a configuration for it.
Definition: ObjectCache.php:410
MediaWiki\Linker\LinkRenderer
Class that generates HTML links for pages.
Definition: LinkRenderer.php:41
$result
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. & $title:Title object for the current page & $request:WebRequest & $ignoreRedirect:boolean to skip redirect check & $target:Title/string of redirect target & $article:Article object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) & $article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Array with elements of the form "language:title" in the order that they will be output. & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead. Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1983
MWLBFactory\applyDefaultConfig
static applyDefaultConfig(array $lbConf, Config $mainConfig, ConfiguredReadOnlyMode $readOnlyMode, BagOStuff $srvCace, BagOStuff $mainStash, WANObjectCache $wanCache)
Definition: MWLBFactory.php:46
ReadOnlyMode
A service class for fetching the wiki's current read-only mode.
Definition: ReadOnlyMode.php:11
CachingSiteStore
Definition: CachingSiteStore.php:31
MIGRATION_NEW
const MIGRATION_NEW
Definition: Defines.php:318
CACHE_ACCEL
const CACHE_ACCEL
Definition: Defines.php:105
GenderCache
Caches user genders when needed to use correct namespace aliases.
Definition: GenderCache.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
$params
$params
Definition: styleTest.css.php:44
BagOStuff
Class representing a cache/ephemeral data store.
Definition: BagOStuff.php:58
MediaWiki\Linker\LinkRendererFactory
Factory to create LinkRender objects.
Definition: LinkRendererFactory.php:31
SearchEngineFactory
Factory class for SearchEngine.
Definition: SearchEngineFactory.php:9
Revision\RevisionFactory
Service for constructing revision objects.
Definition: RevisionFactory.php:37
ActorMigration
This class handles the logic for the actor table migration.
Definition: ActorMigration.php:35
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:1043
SiteLookup
Definition: SiteLookup.php:28
Revision\RevisionLookup
Service for looking up page revisions.
Definition: RevisionLookup.php:38
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
MediaHandlerFactory
Class to construct MediaHandler objects.
Definition: MediaHandlerFactory.php:29
SiteStore
Definition: SiteStore.php:29
Config
Interface for configuration instances.
Definition: Config.php:28
Revision\SlotRoleRegistry\defineRole
defineRole( $role, callable $instantiator)
Defines a slot role.
Definition: SlotRoleRegistry.php:84
CryptHKDF
Definition: CryptHKDF.php:33
WatchedItemQueryService
Definition: WatchedItemQueryService.php:18
ProxyLookup
Definition: ProxyLookup.php:27
VirtualRESTServiceClient
Virtual HTTP service client loosely styled after a Virtual File System.
Definition: VirtualRESTServiceClient.php:45
MediaWiki\Interwiki\InterwikiLookup
Service interface for looking up Interwiki records.
Definition: InterwikiLookup.php:31
MediaWiki
A helper class for throttling authentication attempts.
$IP
$IP
Definition: update.php:3
SkinFallback
SkinTemplate class for the fallback skin.
Definition: SkinFallback.php:12
ObjectCache\getInstance
static getInstance( $id)
Get a cached instance of the specified type of cache object.
Definition: ObjectCache.php:92
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:289
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
DBSiteStore
Definition: DBSiteStore.php:33
MediaWiki\Storage\BlobStoreFactory
Service for instantiating BlobStores.
Definition: BlobStoreFactory.php:35
wfGetCache
wfGetCache( $cacheType)
Get a specific cache object.
Definition: GlobalFunctions.php:2962
TitleParser
A title parser service for MediaWiki.
Definition: TitleParser.php:33
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:271
MediaWiki\Special\SpecialPageFactory
Factory for handling the special page list and generating SpecialPage objects.
Definition: SpecialPageFactory.php:63
wfUrlProtocols
wfUrlProtocols( $includeProtocolRelative=true)
Returns a regular expression of url protocols.
Definition: GlobalFunctions.php:743
ExternalStoreFactory
Definition: ExternalStoreFactory.php:9
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:43
ParserFactory
Definition: ParserFactory.php:28
MWLBFactory\setSchemaAliases
static setSchemaAliases(LBFactory $lbFactory, Config $config)
Definition: MWLBFactory.php:322
PrefixingStatsdDataFactoryProxy
Proxy to prefix metric keys sent to a StatsdDataFactoryInterface.
Definition: PrefixingStatsdDataFactoryProxy.php:29
SkinFactory
Factory class to create Skin objects.
Definition: SkinFactory.php:31
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:51
WANObjectCache
Multi-datacenter aware caching interface.
Definition: WANObjectCache.php:116
CACHE_ANYTHING
const CACHE_ANYTHING
Definition: Defines.php:101
include
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might include
Definition: hooks.txt:780
MediaWiki\Config\ConfigRepository
Object which holds currently registered configuration options.
Definition: ConfigRepository.php:33
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:430
Revision\RevisionStoreFactory
Factory service for RevisionStore instances.
Definition: RevisionStoreFactory.php:49
MediaWiki\Auth\AuthManager
This serves as the entry point to the authentication system.
Definition: AuthManager.php:84
MediaWiki\Storage\BlobStore
Service for loading and storing data blobs.
Definition: BlobStore.php:33
WatchedItemStore
Storage layer class for WatchedItems.
Definition: WatchedItemStore.php:19
IBufferingStatsdDataFactory
MediaWiki adaptation of StatsdDataFactory that provides buffering functionality.
Definition: IBufferingStatsdDataFactory.php:10
ImportableUploadRevisionImporter
Definition: ImportableUploadRevisionImporter.php:8
OldRevisionImporter
Definition: OldRevisionImporter.php:6
JobQueueGroup\singleton
static singleton( $domain=false)
Definition: JobQueueGroup.php:70
$cache
$cache
Definition: mcc.php:33
TitleFormatter
A title formatter service for MediaWiki.
Definition: TitleFormatter.php:34
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
$skin
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned $skin
Definition: hooks.txt:1985
Wikimedia
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
ParserCache
Definition: ParserCache.php:30
ConfigFactory
Factory class to create Config objects.
Definition: ConfigFactory.php:31
LoggerFactory
MediaWiki Logger LoggerFactory implements a PSR[0] compatible message logging system Named Psr Log LoggerInterface instances can be obtained from the MediaWiki Logger LoggerFactory::getInstance() static method. MediaWiki\Logger\LoggerFactory expects a class implementing the MediaWiki\Logger\Spi interface to act as a factory for new Psr\Log\LoggerInterface instances. The "Spi" in MediaWiki\Logger\Spi stands for "service provider interface". An SPI is an API intended to be implemented or extended by a third party. This software design pattern is intended to enable framework extension and replaceable components. It is specifically used in the MediaWiki\Logger\LoggerFactory service to allow alternate PSR-3 logging implementations to be easily integrated with MediaWiki. The service provider interface allows the backend logging library to be implemented in multiple ways. The $wgMWLoggerDefaultSpi global provides the classname of the default MediaWiki\Logger\Spi implementation to be loaded at runtime. This can either be the name of a class implementing the MediaWiki\Logger\Spi with a zero argument const ructor or a callable that will return an MediaWiki\Logger\Spi instance. Alternately the MediaWiki\Logger\LoggerFactory MediaWiki Logger LoggerFactory
Definition: logger.txt:5
WatchedItemStore\setStatsdDataFactory
setStatsdDataFactory(StatsdDataFactoryInterface $stats)
Definition: WatchedItemStore.php:119
MediaWiki\Preferences\DefaultPreferencesFactory
This is the default implementation of PreferencesFactory.
Definition: DefaultPreferencesFactory.php:61
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
Language\factory
static factory( $code)
Get a cached or new language object for a given language code.
Definition: Language.php:215
PasswordFactory
Factory class for creating and checking Password objects.
Definition: PasswordFactory.php:28
$services
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place or wrap services the preferred way to define a new service is the $wgServiceWiringFiles array $services
Definition: hooks.txt:2220
MediaWikiServices
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
Definition: injection.txt:23
wfIsHHVM
wfIsHHVM()
Check if we are running under HHVM.
Definition: GlobalFunctions.php:1964
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200
Revision\RevisionRenderer\setLogger
setLogger(LoggerInterface $saveParseLogger)
Definition: RevisionRenderer.php:79
CryptRand
Definition: CryptRand.php:30
Language
Internationalisation code.
Definition: Language.php:36
Http
Various HTTP related functions.
Definition: Http.php:27
NoWriteWatchedItemStore
Definition: NoWriteWatchedItemStore.php:28
MediaWiki\Block\BlockRestrictionStore
Definition: BlockRestrictionStore.php:33
ParserCache
In both all secondary updates will be triggered handle like object that caches derived data representing a and can trigger updates of cached copies of that e g in the links the ParserCache
Definition: pageupdater.txt:78