MediaWiki  1.32.0
ServiceWiring.php
Go to the documentation of this file.
1 <?php
40 use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
62 
63 return [
64  'ActorMigration' => function ( MediaWikiServices $services ) : ActorMigration {
65  return new ActorMigration(
66  $services->getMainConfig()->get( 'ActorTableSchemaMigrationStage' )
67  );
68  },
69 
70  'BlobStore' => function ( MediaWikiServices $services ) : BlobStore {
71  return $services->getService( '_SqlBlobStore' );
72  },
73 
74  'BlobStoreFactory' => function ( MediaWikiServices $services ) : BlobStoreFactory {
75  return new BlobStoreFactory(
76  $services->getDBLoadBalancerFactory(),
77  $services->getMainWANObjectCache(),
78  $services->getMainConfig(),
79  $services->getContentLanguage()
80  );
81  },
82 
83  'CommentStore' => function ( MediaWikiServices $services ) : CommentStore {
84  return new CommentStore(
85  $services->getContentLanguage(),
86  $services->getMainConfig()->get( 'CommentTableSchemaMigrationStage' )
87  );
88  },
89 
90  'ConfigFactory' => function ( MediaWikiServices $services ) : ConfigFactory {
91  // Use the bootstrap config to initialize the ConfigFactory.
92  $registry = $services->getBootstrapConfig()->get( 'ConfigRegistry' );
93  $factory = new ConfigFactory();
94 
95  foreach ( $registry as $name => $callback ) {
96  $factory->register( $name, $callback );
97  }
98  return $factory;
99  },
100 
101  'ConfigRepository' => function ( MediaWikiServices $services ) : ConfigRepository {
102  return new ConfigRepository( $services->getConfigFactory() );
103  },
104 
105  'ConfiguredReadOnlyMode' => function ( MediaWikiServices $services ) : ConfiguredReadOnlyMode {
106  return new ConfiguredReadOnlyMode( $services->getMainConfig() );
107  },
108 
109  'ContentLanguage' => function ( MediaWikiServices $services ) : Language {
110  return Language::factory( $services->getMainConfig()->get( 'LanguageCode' ) );
111  },
112 
113  'CryptHKDF' => function ( MediaWikiServices $services ) : CryptHKDF {
114  $config = $services->getMainConfig();
115 
116  $secret = $config->get( 'HKDFSecret' ) ?: $config->get( 'SecretKey' );
117  if ( !$secret ) {
118  throw new RuntimeException( "Cannot use MWCryptHKDF without a secret." );
119  }
120 
121  // In HKDF, the context can be known to the attacker, but this will
122  // keep simultaneous runs from producing the same output.
123  $context = [ microtime(), getmypid(), gethostname() ];
124 
125  // Setup salt cache. Use APC, or fallback to the main cache if it isn't setup
126  $cache = $services->getLocalServerObjectCache();
127  if ( $cache instanceof EmptyBagOStuff ) {
129  }
130 
131  return new CryptHKDF( $secret, $config->get( 'HKDFAlgorithm' ), $cache, $context );
132  },
133 
134  'CryptRand' => function () : CryptRand {
135  return new CryptRand();
136  },
137 
138  'DBLoadBalancer' => function ( MediaWikiServices $services ) : Wikimedia\Rdbms\LoadBalancer {
139  // just return the default LB from the DBLoadBalancerFactory service
140  return $services->getDBLoadBalancerFactory()->getMainLB();
141  },
142 
143  'DBLoadBalancerFactory' =>
144  function ( MediaWikiServices $services ) : Wikimedia\Rdbms\LBFactory {
145  $mainConfig = $services->getMainConfig();
146 
148  $mainConfig->get( 'LBFactoryConf' ),
149  $mainConfig,
150  $services->getConfiguredReadOnlyMode()
151  );
152  $class = MWLBFactory::getLBFactoryClass( $lbConf );
153 
154  $instance = new $class( $lbConf );
155  MWLBFactory::setSchemaAliases( $instance, $mainConfig );
156 
157  return $instance;
158  },
159 
160  'EventRelayerGroup' => function ( MediaWikiServices $services ) : EventRelayerGroup {
161  return new EventRelayerGroup( $services->getMainConfig()->get( 'EventRelayerConfig' ) );
162  },
163 
164  'ExternalStoreFactory' => function ( MediaWikiServices $services ) : ExternalStoreFactory {
165  $config = $services->getMainConfig();
166 
167  return new ExternalStoreFactory(
168  $config->get( 'ExternalStores' )
169  );
170  },
171 
172  'GenderCache' => function ( MediaWikiServices $services ) : GenderCache {
173  return new GenderCache();
174  },
175 
176  'HttpRequestFactory' =>
177  function ( MediaWikiServices $services ) : \MediaWiki\Http\HttpRequestFactory {
178  return new \MediaWiki\Http\HttpRequestFactory();
179  },
180 
181  'InterwikiLookup' => function ( MediaWikiServices $services ) : InterwikiLookup {
182  $config = $services->getMainConfig();
183  return new ClassicInterwikiLookup(
184  $services->getContentLanguage(),
185  $services->getMainWANObjectCache(),
186  $config->get( 'InterwikiExpiry' ),
187  $config->get( 'InterwikiCache' ),
188  $config->get( 'InterwikiScopes' ),
189  $config->get( 'InterwikiFallbackSite' )
190  );
191  },
192 
193  'LinkCache' => function ( MediaWikiServices $services ) : LinkCache {
194  return new LinkCache(
195  $services->getTitleFormatter(),
196  $services->getMainWANObjectCache()
197  );
198  },
199 
200  'LinkRenderer' => function ( MediaWikiServices $services ) : LinkRenderer {
201  global $wgUser;
202 
203  if ( defined( 'MW_NO_SESSION' ) ) {
204  return $services->getLinkRendererFactory()->create();
205  } else {
206  return $services->getLinkRendererFactory()->createForUser( $wgUser );
207  }
208  },
209 
210  'LinkRendererFactory' => function ( MediaWikiServices $services ) : LinkRendererFactory {
211  return new LinkRendererFactory(
212  $services->getTitleFormatter(),
213  $services->getLinkCache()
214  );
215  },
216 
217  'LocalServerObjectCache' => function ( MediaWikiServices $services ) : BagOStuff {
219  return \ObjectCache::newFromId( $cacheId );
220  },
221 
222  'MagicWordFactory' => function ( MediaWikiServices $services ) : MagicWordFactory {
223  return new MagicWordFactory( $services->getContentLanguage() );
224  },
225 
226  'MainConfig' => function ( MediaWikiServices $services ) : Config {
227  // Use the 'main' config from the ConfigFactory service.
228  return $services->getConfigFactory()->makeConfig( 'main' );
229  },
230 
231  'MainObjectStash' => function ( MediaWikiServices $services ) : BagOStuff {
232  $mainConfig = $services->getMainConfig();
233 
234  $id = $mainConfig->get( 'MainStash' );
235  if ( !isset( $mainConfig->get( 'ObjectCaches' )[$id] ) ) {
236  throw new UnexpectedValueException(
237  "Cache type \"$id\" is not present in \$wgObjectCaches." );
238  }
239 
240  return \ObjectCache::newFromParams( $mainConfig->get( 'ObjectCaches' )[$id] );
241  },
242 
243  'MainWANObjectCache' => function ( MediaWikiServices $services ) : WANObjectCache {
244  $mainConfig = $services->getMainConfig();
245 
246  $id = $mainConfig->get( 'MainWANCache' );
247  if ( !isset( $mainConfig->get( 'WANObjectCaches' )[$id] ) ) {
248  throw new UnexpectedValueException(
249  "WAN cache type \"$id\" is not present in \$wgWANObjectCaches." );
250  }
251 
252  $params = $mainConfig->get( 'WANObjectCaches' )[$id];
253  $objectCacheId = $params['cacheId'];
254  if ( !isset( $mainConfig->get( 'ObjectCaches' )[$objectCacheId] ) ) {
255  throw new UnexpectedValueException(
256  "Cache type \"$objectCacheId\" is not present in \$wgObjectCaches." );
257  }
258  $params['store'] = $mainConfig->get( 'ObjectCaches' )[$objectCacheId];
259 
260  return \ObjectCache::newWANCacheFromParams( $params );
261  },
262 
263  'MediaHandlerFactory' => function ( MediaWikiServices $services ) : MediaHandlerFactory {
264  return new MediaHandlerFactory(
265  $services->getMainConfig()->get( 'MediaHandlers' )
266  );
267  },
268 
269  'MimeAnalyzer' => function ( MediaWikiServices $services ) : MimeAnalyzer {
270  $logger = LoggerFactory::getInstance( 'Mime' );
271  $mainConfig = $services->getMainConfig();
272  $params = [
273  'typeFile' => $mainConfig->get( 'MimeTypeFile' ),
274  'infoFile' => $mainConfig->get( 'MimeInfoFile' ),
275  'xmlTypes' => $mainConfig->get( 'XMLMimeTypes' ),
276  'guessCallback' =>
277  function ( $mimeAnalyzer, &$head, &$tail, $file, &$mime ) use ( $logger ) {
278  // Also test DjVu
279  $deja = new DjVuImage( $file );
280  if ( $deja->isValid() ) {
281  $logger->info( "Detected $file as image/vnd.djvu\n" );
282  $mime = 'image/vnd.djvu';
283 
284  return;
285  }
286  // Some strings by reference for performance - assuming well-behaved hooks
287  Hooks::run(
288  'MimeMagicGuessFromContent',
289  [ $mimeAnalyzer, &$head, &$tail, $file, &$mime ]
290  );
291  },
292  'extCallback' => function ( $mimeAnalyzer, $ext, &$mime ) {
293  // Media handling extensions can improve the MIME detected
294  Hooks::run( 'MimeMagicImproveFromExtension', [ $mimeAnalyzer, $ext, &$mime ] );
295  },
296  'initCallback' => function ( $mimeAnalyzer ) {
297  // Allow media handling extensions adding MIME-types and MIME-info
298  Hooks::run( 'MimeMagicInit', [ $mimeAnalyzer ] );
299  },
300  'logger' => $logger
301  ];
302 
303  if ( $params['infoFile'] === 'includes/mime.info' ) {
304  $params['infoFile'] = __DIR__ . "/libs/mime/mime.info";
305  }
306 
307  if ( $params['typeFile'] === 'includes/mime.types' ) {
308  $params['typeFile'] = __DIR__ . "/libs/mime/mime.types";
309  }
310 
311  $detectorCmd = $mainConfig->get( 'MimeDetectorCommand' );
312  if ( $detectorCmd ) {
313  $factory = $services->getShellCommandFactory();
314  $params['detectCallback'] = function ( $file ) use ( $detectorCmd, $factory ) {
315  $result = $factory->create()
316  // $wgMimeDetectorCommand can contain commands with parameters
317  ->unsafeParams( $detectorCmd )
318  ->params( $file )
319  ->execute();
320  return $result->getStdout();
321  };
322  }
323 
324  return new MimeAnalyzer( $params );
325  },
326 
327  'NameTableStoreFactory' => function ( MediaWikiServices $services ) : NameTableStoreFactory {
328  return new NameTableStoreFactory(
329  $services->getDBLoadBalancerFactory(),
330  $services->getMainWANObjectCache(),
331  LoggerFactory::getInstance( 'NameTableSqlStore' )
332  );
333  },
334 
335  'OldRevisionImporter' => function ( MediaWikiServices $services ) : OldRevisionImporter {
337  true,
338  LoggerFactory::getInstance( 'OldRevisionImporter' ),
339  $services->getDBLoadBalancer()
340  );
341  },
342 
343  'Parser' => function ( MediaWikiServices $services ) : Parser {
344  return $services->getParserFactory()->create();
345  },
346 
347  'ParserCache' => function ( MediaWikiServices $services ) : ParserCache {
348  $config = $services->getMainConfig();
349  $cache = ObjectCache::getInstance( $config->get( 'ParserCacheType' ) );
350  wfDebugLog( 'caches', 'parser: ' . get_class( $cache ) );
351 
352  return new ParserCache(
353  $cache,
354  $config->get( 'CacheEpoch' )
355  );
356  },
357 
358  'ParserFactory' => function ( MediaWikiServices $services ) : ParserFactory {
359  return new ParserFactory(
360  $services->getMainConfig()->get( 'ParserConf' ),
361  $services->getMagicWordFactory(),
362  $services->getContentLanguage(),
363  wfUrlProtocols(),
364  $services->getSpecialPageFactory()
365  );
366  },
367 
368  'PasswordFactory' => function ( MediaWikiServices $services ) : PasswordFactory {
369  $config = $services->getMainConfig();
370  return new PasswordFactory(
371  $config->get( 'PasswordConfig' ),
372  $config->get( 'PasswordDefault' )
373  );
374  },
375 
376  'PerDbNameStatsdDataFactory' =>
377  function ( MediaWikiServices $services ) : StatsdDataFactoryInterface {
378  $config = $services->getMainConfig();
379  $wiki = $config->get( 'DBname' );
381  $services->getStatsdDataFactory(),
382  $wiki
383  );
384  },
385 
386  'PreferencesFactory' => function ( MediaWikiServices $services ) : PreferencesFactory {
387  $factory = new DefaultPreferencesFactory(
388  $services->getMainConfig(),
389  $services->getContentLanguage(),
390  AuthManager::singleton(),
391  $services->getLinkRendererFactory()->create()
392  );
393  $factory->setLogger( LoggerFactory::getInstance( 'preferences' ) );
394 
395  return $factory;
396  },
397 
398  'ProxyLookup' => function ( MediaWikiServices $services ) : ProxyLookup {
399  $mainConfig = $services->getMainConfig();
400  return new ProxyLookup(
401  $mainConfig->get( 'SquidServers' ),
402  $mainConfig->get( 'SquidServersNoPurge' )
403  );
404  },
405 
406  'ReadOnlyMode' => function ( MediaWikiServices $services ) : ReadOnlyMode {
407  return new ReadOnlyMode(
408  $services->getConfiguredReadOnlyMode(),
409  $services->getDBLoadBalancer()
410  );
411  },
412 
413  'RevisionFactory' => function ( MediaWikiServices $services ) : RevisionFactory {
414  return $services->getRevisionStore();
415  },
416 
417  'RevisionLookup' => function ( MediaWikiServices $services ) : RevisionLookup {
418  return $services->getRevisionStore();
419  },
420 
421  'RevisionRenderer' => function ( MediaWikiServices $services ) : RevisionRenderer {
422  $renderer = new RevisionRenderer( $services->getDBLoadBalancer() );
423  $renderer->setLogger( LoggerFactory::getInstance( 'SaveParse' ) );
424 
425  return $renderer;
426  },
427 
428  'RevisionStore' => function ( MediaWikiServices $services ) : RevisionStore {
429  return $services->getRevisionStoreFactory()->getRevisionStore();
430  },
431 
432  'RevisionStoreFactory' => function ( MediaWikiServices $services ) : RevisionStoreFactory {
433  $config = $services->getMainConfig();
434  $store = new RevisionStoreFactory(
435  $services->getDBLoadBalancerFactory(),
436  $services->getBlobStoreFactory(),
437  $services->getNameTableStoreFactory(),
438  $services->getMainWANObjectCache(),
439  $services->getCommentStore(),
440  $services->getActorMigration(),
441  $config->get( 'MultiContentRevisionSchemaMigrationStage' ),
442  LoggerFactory::getProvider(),
443  $config->get( 'ContentHandlerUseDB' )
444  );
445 
446  return $store;
447  },
448 
449  'SearchEngineConfig' => function ( MediaWikiServices $services ) : SearchEngineConfig {
450  return new SearchEngineConfig( $services->getMainConfig(),
451  $services->getContentLanguage() );
452  },
453 
454  'SearchEngineFactory' => function ( MediaWikiServices $services ) : SearchEngineFactory {
455  return new SearchEngineFactory( $services->getSearchEngineConfig() );
456  },
457 
458  'ShellCommandFactory' => function ( MediaWikiServices $services ) : CommandFactory {
459  $config = $services->getMainConfig();
460 
461  $limits = [
462  'time' => $config->get( 'MaxShellTime' ),
463  'walltime' => $config->get( 'MaxShellWallClockTime' ),
464  'memory' => $config->get( 'MaxShellMemory' ),
465  'filesize' => $config->get( 'MaxShellFileSize' ),
466  ];
467  $cgroup = $config->get( 'ShellCgroup' );
468  $restrictionMethod = $config->get( 'ShellRestrictionMethod' );
469 
470  $factory = new CommandFactory( $limits, $cgroup, $restrictionMethod );
471  $factory->setLogger( LoggerFactory::getInstance( 'exec' ) );
472  $factory->logStderr();
473 
474  return $factory;
475  },
476 
477  'SiteLookup' => function ( MediaWikiServices $services ) : SiteLookup {
478  $cacheFile = $services->getMainConfig()->get( 'SitesCacheFile' );
479 
480  if ( $cacheFile !== false ) {
481  return new FileBasedSiteLookup( $cacheFile );
482  } else {
483  // Use the default SiteStore as the SiteLookup implementation for now
484  return $services->getSiteStore();
485  }
486  },
487 
488  'SiteStore' => function ( MediaWikiServices $services ) : SiteStore {
489  $rawSiteStore = new DBSiteStore( $services->getDBLoadBalancer() );
490 
491  // TODO: replace wfGetCache with a CacheFactory service.
492  // TODO: replace wfIsHHVM with a capabilities service.
494 
495  return new CachingSiteStore( $rawSiteStore, $cache );
496  },
497 
498  'SkinFactory' => function ( MediaWikiServices $services ) : SkinFactory {
499  $factory = new SkinFactory();
500 
501  $names = $services->getMainConfig()->get( 'ValidSkinNames' );
502 
503  foreach ( $names as $name => $skin ) {
504  $factory->register( $name, $skin, function () use ( $name, $skin ) {
505  $class = "Skin$skin";
506  return new $class( $name );
507  } );
508  }
509  // Register a hidden "fallback" skin
510  $factory->register( 'fallback', 'Fallback', function () {
511  return new SkinFallback;
512  } );
513  // Register a hidden skin for api output
514  $factory->register( 'apioutput', 'ApiOutput', function () {
515  return new SkinApi;
516  } );
517 
518  return $factory;
519  },
520 
521  'SpecialPageFactory' => function ( MediaWikiServices $services ) : SpecialPageFactory {
522  return new SpecialPageFactory(
523  $services->getMainConfig(),
524  $services->getContentLanguage()
525  );
526  },
527 
528  'StatsdDataFactory' => function ( MediaWikiServices $services ) : IBufferingStatsdDataFactory {
529  return new BufferingStatsdDataFactory(
530  rtrim( $services->getMainConfig()->get( 'StatsdMetricPrefix' ), '.' )
531  );
532  },
533 
534  'TitleFormatter' => function ( MediaWikiServices $services ) : TitleFormatter {
535  return $services->getService( '_MediaWikiTitleCodec' );
536  },
537 
538  'TitleParser' => function ( MediaWikiServices $services ) : TitleParser {
539  return $services->getService( '_MediaWikiTitleCodec' );
540  },
541 
542  'UploadRevisionImporter' => function ( MediaWikiServices $services ) : UploadRevisionImporter {
544  $services->getMainConfig()->get( 'EnableUploads' ),
545  LoggerFactory::getInstance( 'UploadRevisionImporter' )
546  );
547  },
548 
549  'VirtualRESTServiceClient' =>
551  $config = $services->getMainConfig()->get( 'VirtualRestConfig' );
552 
553  $vrsClient = new VirtualRESTServiceClient( new MultiHttpClient( [] ) );
554  foreach ( $config['paths'] as $prefix => $serviceConfig ) {
555  $class = $serviceConfig['class'];
556  // Merge in the global defaults
557  $constructArg = $serviceConfig['options'] ?? [];
558  $constructArg += $config['global'];
559  // Make the VRS service available at the mount point
560  $vrsClient->mount( $prefix, [ 'class' => $class, 'config' => $constructArg ] );
561  }
562 
563  return $vrsClient;
564  },
565 
566  'WatchedItemQueryService' =>
568  return new WatchedItemQueryService(
569  $services->getDBLoadBalancer(),
570  $services->getCommentStore(),
571  $services->getActorMigration()
572  );
573  },
574 
575  'WatchedItemStore' => function ( MediaWikiServices $services ) : WatchedItemStore {
576  $store = new WatchedItemStore(
577  $services->getDBLoadBalancerFactory(),
578  new HashBagOStuff( [ 'maxKeys' => 100 ] ),
579  $services->getReadOnlyMode(),
580  $services->getMainConfig()->get( 'UpdateRowsPerQuery' )
581  );
582  $store->setStatsdDataFactory( $services->getStatsdDataFactory() );
583 
584  if ( $services->getMainConfig()->get( 'ReadOnlyWatchedItemStore' ) ) {
585  $store = new NoWriteWatchedItemStore( $store );
586  }
587 
588  return $store;
589  },
590 
591  'WikiRevisionOldRevisionImporterNoUpdates' =>
594  false,
595  LoggerFactory::getInstance( 'OldRevisionImporter' ),
596  $services->getDBLoadBalancer()
597  );
598  },
599 
600  '_MediaWikiTitleCodec' => function ( MediaWikiServices $services ) : MediaWikiTitleCodec {
601  return new MediaWikiTitleCodec(
602  $services->getContentLanguage(),
603  $services->getGenderCache(),
604  $services->getMainConfig()->get( 'LocalInterwikis' ),
605  $services->getInterwikiLookup()
606  );
607  },
608 
609  '_SqlBlobStore' => function ( MediaWikiServices $services ) : SqlBlobStore {
610  return $services->getBlobStoreFactory()->newSqlBlobStore();
611  },
612 
614  // NOTE: When adding a service here, don't forget to add a getter function
615  // in the MediaWikiServices class. The convenience getter should just call
616  // $this->getService( 'FooBarService' ).
618 
619 ];
EventRelayerGroup
Factory class for spawning EventRelayer objects using configuration.
Definition: EventRelayerGroup.php:28
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
FileBasedSiteLookup
Provides a file-based cache of a SiteStore.
Definition: FileBasedSiteLookup.php:33
UploadRevisionImporter
Definition: UploadRevisionImporter.php:6
ObjectCache\getLocalClusterInstance
static getLocalClusterInstance()
Get the main cluster-local cache object.
Definition: ObjectCache.php:365
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:2675
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:46
EmptyBagOStuff
A BagOStuff object with no objects in it.
Definition: EmptyBagOStuff.php:29
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:99
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:50
ObjectCache\detectLocalServerCache
static detectLocalServerCache()
Detects which local server cache library is present and returns a configuration for it.
Definition: ObjectCache.php:419
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. 'LanguageGetMagic':DEPRECATED since 1.16! Use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language & $magicExtensions:associative array of magic words synonyms $lang:language code(string) '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 'LanguageGetSpecialPageAliases':DEPRECATED! Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language & $specialPageAliases:associative array of magic words synonyms $lang:language code(string) '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:2034
ReadOnlyMode
A service class for fetching the wiki's current read-only mode.
Definition: ReadOnlyMode.php:11
CachingSiteStore
Definition: CachingSiteStore.php:31
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:1082
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
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.
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:179
MWLBFactory\applyDefaultConfig
static applyDefaultConfig(array $lbConf, Config $mainConfig, ConfiguredReadOnlyMode $readOnlyMode)
Definition: MWLBFactory.php:44
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:3019
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:302
$mime
if( $ext=='php'|| $ext=='php5') $mime
Definition: router.php:59
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:740
ExternalStoreFactory
Definition: ExternalStoreFactory.php:9
Revision\RevisionRenderer
The RevisionRenderer service provides access to rendered output for revisions.
Definition: RevisionRenderer.php:45
ParserFactory
Definition: ParserFactory.php:27
MWLBFactory\setSchemaAliases
static setSchemaAliases(LBFactory $lbFactory, Config $config)
Definition: MWLBFactory.php:212
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:118
CACHE_ANYTHING
const CACHE_ANYTHING
Definition: Defines.php:101
MediaWiki\Config\ConfigRepository
Object which holds currently registered configuration options.
Definition: ConfigRepository.php:33
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:83
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
$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:2036
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:96
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
Language\factory
static factory( $code)
Get a cached or new language object for a given language code.
Definition: Language.php:214
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:2270
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:2006
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:70
$ext
$ext
Definition: router.php:55
CryptRand
Definition: CryptRand.php:30
Language
Internationalisation code.
Definition: Language.php:35
Http
Various HTTP related functions.
Definition: Http.php:27
NoWriteWatchedItemStore
Definition: NoWriteWatchedItemStore.php:28
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