Go to the documentation of this file.
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' => [],
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 ) ) {
229 if ( !in_array( $key, self::$notAttributes )
230 && !in_array( $key, self::$creditsAttributes )
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'] ) ) {
292 if ( is_array(
$value ) ) {
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] ) ) {
522 if ( isset( $info[
'load_composer_autoloader'] ) && $info[
'load_composer_autoloader'] ===
true ) {
523 $path =
"$dir/vendor/autoload.php";
524 if ( file_exists(
$path ) ) {
getRequirements(array $info)
Get the requirements for the provided info.
extractParserTestFiles( $dir, array $info)
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...
static array $mergeStrategies
Mapping of global settings to their specific merge strategies.
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
extractResourceLoaderModules( $dir, array $info)
extractConfig1(array $info)
Set configuration settings for manifest_version == 1.
storeToArray( $path, $name, $value, &$array)
Processors read associated arrays and register whatever is required.
Allows to change the fields on the form that will be generated $name
extractExtensionMessagesFiles( $dir, array $info)
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
const MERGE_STRATEGY
Special key that defines the merge strategy.
extractHooks(array $info)
extractServiceWiringFiles( $dir, array $info)
extractConfig2(array $info, $dir)
Set configuration settings for manifest_version == 2.
array $globals
Stuff that is going to be set to $GLOBALS.
getExtraAutoloaderPaths( $dir, array $info)
Get the path for additional autoloaders, e.g.
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
extractNamespaces(array $info)
Register namespaces with the appropriate global settings.
array $extAttributes
Extension attributes, keyed by name => settings.
static array $globalSettings
Keys that should be set to $GLOBALS.
static array $creditsAttributes
Keys that are part of the extension credits.
extractAttributes( $path, array $info)
extractCredits( $path, array $info)
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
extractInfo( $path, array $info, $version)
array $defines
Things that should be define()'d.
array $attributes
Any thing else in the $info that hasn't already been processed.
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.
the array() calling protocol came about after MediaWiki 1.4rc1.