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 ) ) {
240 $this->
storeToArray( $path, $key, $val, $this->attributes );
244 if ( !in_array( $key, self::$notAttributes )
245 && !in_array( $key, self::$creditsAttributes )
248 $this->
storeToArray( $path, $key, $val, $this->attributes );
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'] ) ) {
306 foreach ( $info[
'Hooks'] as $name =>
$value ) {
307 if ( is_array(
$value ) ) {
308 foreach (
$value as $callback ) {
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." );
519 foreach ( $paths as $path ) {
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] ) ) {
536 $array[
$name] = array_merge_recursive( $array[$name],
$value );
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.
Allows to change the fields on the form that will be generated $name
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
Processors read associated arrays and register whatever is required.