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 );
189 if ( $version === 2 ) {
203 if ( isset( $info[
'callback'] ) ) {
204 $this->callbacks[
$name] = $info[
'callback'];
207 if ( $version === 2 ) {
211 foreach ( $info as $key => $val ) {
213 if ( in_array( $key, self::$globalSettings ) ) {
218 if ( $key[0] ===
'@' ) {
222 if ( $version === 2 ) {
224 if ( in_array( $key, self::$coreAttributes ) ) {
225 $this->
storeToArray( $path, $key, $val, $this->attributes );
229 if ( !in_array( $key, self::$notAttributes )
230 && !in_array( $key, self::$creditsAttributes )
233 $this->
storeToArray( $path, $key, $val, $this->attributes );
245 if ( isset( $info[
'attributes'] ) ) {
246 foreach ( $info[
'attributes'] as $extName =>
$value ) {
254 foreach ( $this->
globals as $key => $val ) {
255 if ( isset( self::$mergeStrategies[$key] ) ) {
261 foreach ( $this->extAttributes as $extName =>
$value ) {
263 if ( isset( $this->credits[$extName] ) ) {
264 foreach (
$value as $attrName => $attrValue ) {
267 $extName . $attrName,
272 unset( $this->extAttributes[$extName] );
286 return isset( $info[
'requires'] ) ? $info[
'requires'] : [];
290 if ( isset( $info[
'Hooks'] ) ) {
291 foreach ( $info[
'Hooks'] as $name =>
$value ) {
292 if ( is_array(
$value ) ) {
293 foreach (
$value as $callback ) {
309 if ( isset( $info[
'namespaces'] ) ) {
310 foreach ( $info[
'namespaces'] as $ns ) {
311 if ( defined( $ns[
'constant'] ) ) {
314 $id = constant( $ns[
'constant'] );
317 $this->defines[ $ns[
'constant'] ] = $id;
320 if ( !( isset( $ns[
'conditional'] ) && $ns[
'conditional'] ) ) {
322 $this->attributes[
'ExtensionNamespaces'][$id] = $ns[
'name'];
324 if ( isset( $ns[
'gender'] ) ) {
325 $this->
globals[
'wgExtraGenderNamespaces'][$id] = $ns[
'gender'];
327 if ( isset( $ns[
'subpages'] ) && $ns[
'subpages'] ) {
328 $this->
globals[
'wgNamespacesWithSubpages'][$id] =
true;
330 if ( isset( $ns[
'content'] ) && $ns[
'content'] ) {
331 $this->
globals[
'wgContentNamespaces'][] = $id;
333 if ( isset( $ns[
'defaultcontentmodel'] ) ) {
334 $this->
globals[
'wgNamespaceContentModels'][$id] = $ns[
'defaultcontentmodel'];
336 if ( isset( $ns[
'protection'] ) ) {
337 $this->
globals[
'wgNamespaceProtection'][$id] = $ns[
'protection'];
339 if ( isset( $ns[
'capitallinkoverride'] ) ) {
340 $this->
globals[
'wgCapitalLinkOverrides'][$id] = $ns[
'capitallinkoverride'];
347 $defaultPaths = isset( $info[
'ResourceFileModulePaths'] )
348 ? $info[
'ResourceFileModulePaths']
350 if ( isset( $defaultPaths[
'localBasePath'] ) ) {
351 if ( $defaultPaths[
'localBasePath'] ===
'' ) {
353 $defaultPaths[
'localBasePath'] =
$dir;
355 $defaultPaths[
'localBasePath'] =
"$dir/{$defaultPaths['localBasePath']}";
359 foreach ( [
'ResourceModules',
'ResourceModuleSkinStyles' ] as $setting ) {
360 if ( isset( $info[$setting] ) ) {
361 foreach ( $info[$setting] as $name => $data ) {
362 if ( isset( $data[
'localBasePath'] ) ) {
363 if ( $data[
'localBasePath'] ===
'' ) {
365 $data[
'localBasePath'] =
$dir;
367 $data[
'localBasePath'] =
"$dir/{$data['localBasePath']}";
370 if ( $defaultPaths ) {
371 $data += $defaultPaths;
380 if ( isset( $info[
'ExtensionMessagesFiles'] ) ) {
381 $this->
globals[
"wgExtensionMessagesFiles"] += array_map(
function ( $file ) use (
$dir ) {
383 }, $info[
'ExtensionMessagesFiles'] );
395 if ( isset( $info[
'MessagesDirs'] ) ) {
396 foreach ( $info[
'MessagesDirs'] as $name => $files ) {
397 foreach ( (array)$files as $file ) {
398 $this->
globals[
"wgMessagesDirs"][
$name][] =
"$dir/$file";
413 'type' => isset( $info[
'type'] ) ? $info[
'type'] :
'other',
415 foreach ( self::$creditsAttributes as $attr ) {
416 if ( isset( $info[$attr] ) ) {
425 if ( isset( $this->credits[$name] ) ) {
426 $firstPath = $this->credits[
$name][
'path'];
428 throw new Exception(
"It was attempted to load $name twice, from $firstPath and $secondPath." );
444 if ( isset( $info[
'config'] ) ) {
445 if ( isset( $info[
'config'][
'_prefix'] ) ) {
446 $prefix = $info[
'config'][
'_prefix'];
447 unset( $info[
'config'][
'_prefix'] );
451 foreach ( $info[
'config'] as $key => $val ) {
452 if ( $key[0] !==
'@' ) {
453 $this->
globals[
"$prefix$key"] = $val;
467 if ( isset( $info[
'config_prefix'] ) ) {
468 $prefix = $info[
'config_prefix'];
472 if ( isset( $info[
'config'] ) ) {
473 foreach ( $info[
'config'] as $key => $data ) {
475 if ( isset( $data[
'merge_strategy'] ) ) {
478 if ( isset( $data[
'path'] ) && $data[
'path'] ) {
487 if ( isset( $info[
'ServiceWiringFiles'] ) ) {
488 foreach ( $info[
'ServiceWiringFiles'] as $path ) {
489 $this->
globals[
'wgServiceWiringFiles'][] =
"$dir/$path";
495 if ( isset( $info[
'ParserTestFiles'] ) ) {
496 foreach ( $info[
'ParserTestFiles'] as $path ) {
497 $this->
globals[
'wgParserTestFiles'][] =
"$dir/$path";
510 if ( !is_array(
$value ) ) {
511 throw new InvalidArgumentException(
"The value for '$name' should be an array (from $path)" );
513 if ( isset( $array[$name] ) ) {
514 $array[
$name] = array_merge_recursive( $array[$name],
$value );
522 if ( isset( $info[
'load_composer_autoloader'] ) && $info[
'load_composer_autoloader'] ===
true ) {
523 $path =
"$dir/vendor/autoload.php";
524 if ( file_exists( $path ) ) {
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)
extractServiceWiringFiles( $dir, 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.
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)
extractParserTestFiles( $dir, array $info)
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.