19 'AuthManagerAutoConfig',
21 'CentralIdLookupProviders',
22 'ChangeCredentialsBlacklist',
26 'ExtensionEntryPointListFiles',
31 'GrantPermissionGroups',
35 'GroupsRemoveFromSelf',
49 'RemoveCredentialsBlacklist',
51 'ResourceLoaderLESSVars',
52 'ResourceLoaderSources',
77 'wgAuthManagerAutoConfig' =>
'array_plus_2d',
78 'wgCapitalLinkOverrides' =>
'array_plus',
79 'wgExtensionCredits' =>
'array_merge_recursive',
80 'wgExtraGenderNamespaces' =>
'array_plus',
81 'wgGrantPermissions' =>
'array_plus_2d',
82 'wgGroupPermissions' =>
'array_plus_2d',
83 'wgHooks' =>
'array_merge_recursive',
84 'wgNamespaceContentModels' =>
'array_plus',
85 'wgNamespaceProtection' =>
'array_plus',
86 'wgNamespacesWithSubpages' =>
'array_plus',
87 'wgPasswordPolicy' =>
'array_merge_recursive',
88 'wgRateLimits' =>
'array_plus_2d',
89 'wgRevokePermissions' =>
'array_plus_2d',
118 'ResourceFileModulePaths',
120 'ResourceModuleSkinStyles',
121 'ExtensionMessagesFiles',
126 'ServiceWiringFiles',
130 'load_composer_autoloader',
141 'wgExtensionMessagesFiles' => [],
142 'wgMessagesDirs' => [],
188 $dir = dirname(
$path );
194 if ( isset( $info[
'ServiceWiringFiles'] ) ) {
196 'wgServiceWiringFiles',
198 $info[
'ServiceWiringFiles']
201 if ( isset( $info[
'ParserTestFiles'] ) ) {
205 $info[
'ParserTestFiles']
209 if ( isset( $info[
'callback'] ) ) {
210 $this->callbacks[
$name] = $info[
'callback'];
215 if ( $version === 2 ) {
222 if ( $version === 2 ) {
226 foreach ( $info
as $key => $val ) {
228 if ( in_array( $key, self::$globalSettings ) ) {
233 if ( $key[0] ===
'@' ) {
237 if ( $version === 2 ) {
239 if ( in_array( $key, self::$coreAttributes ) ) {
244 if ( !in_array( $key, self::$notAttributes )
245 && !in_array( $key, self::$creditsAttributes )
260 if ( isset( $info[
'attributes'] ) ) {
261 foreach ( $info[
'attributes']
as $extName =>
$value ) {
269 foreach ( $this->
globals as $key => $val ) {
270 if ( isset( self::$mergeStrategies[$key] ) ) {
276 foreach ( $this->extAttributes
as $extName =>
$value ) {
278 if ( isset( $this->credits[$extName] ) ) {
279 foreach (
$value as $attrName => $attrValue ) {
282 $extName . $attrName,
287 unset( $this->extAttributes[$extName] );
301 return isset( $info[
'requires'] ) ? $info[
'requires'] : [];
305 if ( isset( $info[
'Hooks'] ) ) {
307 if ( is_array(
$value ) ) {
324 if ( isset( $info[
'namespaces'] ) ) {
325 foreach ( $info[
'namespaces']
as $ns ) {
326 if ( defined( $ns[
'constant'] ) ) {
329 $id = constant( $ns[
'constant'] );
332 $this->defines[ $ns[
'constant'] ] = $id;
335 if ( !( isset( $ns[
'conditional'] ) && $ns[
'conditional'] ) ) {
337 $this->attributes[
'ExtensionNamespaces'][$id] = $ns[
'name'];
339 if ( isset( $ns[
'gender'] ) ) {
340 $this->
globals[
'wgExtraGenderNamespaces'][$id] = $ns[
'gender'];
342 if ( isset( $ns[
'subpages'] ) && $ns[
'subpages'] ) {
343 $this->
globals[
'wgNamespacesWithSubpages'][$id] =
true;
345 if ( isset( $ns[
'content'] ) && $ns[
'content'] ) {
346 $this->
globals[
'wgContentNamespaces'][] = $id;
348 if ( isset( $ns[
'defaultcontentmodel'] ) ) {
349 $this->
globals[
'wgNamespaceContentModels'][$id] = $ns[
'defaultcontentmodel'];
351 if ( isset( $ns[
'protection'] ) ) {
352 $this->
globals[
'wgNamespaceProtection'][$id] = $ns[
'protection'];
354 if ( isset( $ns[
'capitallinkoverride'] ) ) {
355 $this->
globals[
'wgCapitalLinkOverrides'][$id] = $ns[
'capitallinkoverride'];
362 $defaultPaths = isset( $info[
'ResourceFileModulePaths'] )
363 ? $info[
'ResourceFileModulePaths']
365 if ( isset( $defaultPaths[
'localBasePath'] ) ) {
366 if ( $defaultPaths[
'localBasePath'] ===
'' ) {
368 $defaultPaths[
'localBasePath'] = $dir;
370 $defaultPaths[
'localBasePath'] =
"$dir/{$defaultPaths['localBasePath']}";
374 foreach ( [
'ResourceModules',
'ResourceModuleSkinStyles' ]
as $setting ) {
375 if ( isset( $info[$setting] ) ) {
376 foreach ( $info[$setting]
as $name => $data ) {
377 if ( isset( $data[
'localBasePath'] ) ) {
378 if ( $data[
'localBasePath'] ===
'' ) {
380 $data[
'localBasePath'] = $dir;
382 $data[
'localBasePath'] =
"$dir/{$data['localBasePath']}";
385 if ( $defaultPaths ) {
386 $data += $defaultPaths;
395 if ( isset( $info[
'ExtensionMessagesFiles'] ) ) {
396 foreach ( $info[
'ExtensionMessagesFiles']
as &$file ) {
397 $file =
"$dir/$file";
399 $this->
globals[
"wgExtensionMessagesFiles"] += $info[
'ExtensionMessagesFiles'];
411 if ( isset( $info[
'MessagesDirs'] ) ) {
412 foreach ( $info[
'MessagesDirs']
as $name => $files ) {
413 foreach ( (
array)$files
as $file ) {
414 $this->
globals[
"wgMessagesDirs"][
$name][] =
"$dir/$file";
429 'type' => isset( $info[
'type'] ) ? $info[
'type'] :
'other',
431 foreach ( self::$creditsAttributes
as $attr ) {
432 if ( isset( $info[$attr] ) ) {
441 if ( isset( $this->credits[
$name] ) ) {
442 $firstPath = $this->credits[
$name][
'path'];
444 throw new Exception(
"It was attempted to load $name twice, from $firstPath and $secondPath." );
460 if ( isset( $info[
'config'] ) ) {
461 if ( isset( $info[
'config'][
'_prefix'] ) ) {
462 $prefix = $info[
'config'][
'_prefix'];
463 unset( $info[
'config'][
'_prefix'] );
467 foreach ( $info[
'config']
as $key => $val ) {
468 if ( $key[0] !==
'@' ) {
483 if ( isset( $info[
'config_prefix'] ) ) {
484 $prefix = $info[
'config_prefix'];
488 if ( isset( $info[
'config'] ) ) {
489 foreach ( $info[
'config']
as $key => $data ) {
491 if ( isset( $data[
'merge_strategy'] ) ) {
494 if ( isset( $data[
'path'] ) && $data[
'path'] ) {
510 if ( array_key_exists( $key, $this->
globals ) ) {
511 throw new RuntimeException(
512 "The configuration setting '$key' was already set by MediaWiki core or"
513 .
" another extension, and cannot be set again by $extName." );
520 $this->
globals[$global][] =
"$dir/$path";
532 if ( !is_array(
$value ) ) {
533 throw new InvalidArgumentException(
"The value for '$name' should be an array (from $path)" );
535 if ( isset( $array[
$name] ) ) {
544 if ( isset( $info[
'load_composer_autoloader'] ) && $info[
'load_composer_autoloader'] ===
true ) {
545 $paths[] =
"$dir/vendor/autoload.php";
static array $mergeStrategies
Mapping of global settings to their specific merge strategies.
extractNamespaces(array $info)
Register namespaces with the appropriate global settings.
extractCredits( $path, array $info)
array $attributes
Any thing else in the $info that hasn't already been processed.
static string[] $coreAttributes
Top-level attributes that come from MW core.
addConfigGlobal( $key, $value, $extName)
Helper function to set a value to a specific global, if it isn't set already.
callable[] $callbacks
Things to be called once registration of these extensions are done keyed by the name of the extension...
array $defines
Things that should be define()'d.
extractHooks(array $info)
extractExtensionMessagesFiles( $dir, array $info)
extractConfig1(array $info)
Set configuration settings for manifest_version == 1.
array $globals
Stuff that is going to be set to $GLOBALS.
static array $notAttributes
Things that are not 'attributes', but are not in $globalSettings or $creditsAttributes.
extractMessagesDirs( $dir, array $info)
Set message-related settings, which need to be expanded to use absolute paths.
extractConfig2(array $info, $dir)
Set configuration settings for manifest_version == 2.
extractResourceLoaderModules( $dir, array $info)
array $extAttributes
Extension attributes, keyed by name => settings.
getExtraAutoloaderPaths( $dir, array $info)
Get the path for additional autoloaders, e.g.
extractAttributes( $path, array $info)
extractInfo( $path, array $info, $version)
getRequirements(array $info)
Get the requirements for the provided info.
storeToArray( $path, $name, $value, &$array)
extractPathBasedGlobal( $global, $dir, $paths)
static array $creditsAttributes
Keys that are part of the extension credits.
static array $globalSettings
Keys that should be set to $GLOBALS.
const MERGE_STRATEGY
Special key that defines the merge strategy.
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
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining globals
the array() calling protocol came about after MediaWiki 1.4rc1.
Allows to change the fields on the form that will be generated $name
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
Processors read associated arrays and register whatever is required.