Go to the documentation of this file.
19 'AuthManagerAutoConfig',
21 'CentralIdLookupProviders',
22 'ChangeCredentialsBlacklist',
26 'ExtensionEntryPointListFiles',
31 'GrantPermissionGroups',
35 'GroupsRemoveFromSelf',
50 'RemoveCredentialsBlacklist',
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' => [],
193 $dir = dirname(
$path );
199 if ( isset( $info[
'ServiceWiringFiles'] ) ) {
201 'wgServiceWiringFiles',
203 $info[
'ServiceWiringFiles']
206 if ( isset( $info[
'ParserTestFiles'] ) ) {
210 $info[
'ParserTestFiles']
214 if ( isset( $info[
'callback'] ) ) {
215 $this->callbacks[
$name] = $info[
'callback'];
220 if ( $version === 2 ) {
227 if ( $version === 2 ) {
231 foreach ( $info
as $key => $val ) {
233 if ( in_array( $key, self::$globalSettings ) ) {
238 if ( $key[0] ===
'@' ) {
242 if ( $version === 2 ) {
244 if ( in_array( $key, self::$coreAttributes ) ) {
249 if ( !in_array( $key, self::$notAttributes )
250 && !in_array( $key, self::$creditsAttributes )
265 if ( isset( $info[
'attributes'] ) ) {
266 foreach ( $info[
'attributes']
as $extName =>
$value ) {
274 foreach ( $this->
globals as $key => $val ) {
275 if ( isset( self::$mergeStrategies[$key] ) ) {
281 foreach ( $this->extAttributes
as $extName =>
$value ) {
283 if ( isset( $this->credits[$extName] ) ) {
284 foreach (
$value as $attrName => $attrValue ) {
287 $extName . $attrName,
292 unset( $this->extAttributes[$extName] );
307 return $info[
'requires'] ?? [];
311 if ( isset( $info[
'Hooks'] ) ) {
313 if ( is_array(
$value ) ) {
330 if ( isset( $info[
'namespaces'] ) ) {
331 foreach ( $info[
'namespaces']
as $ns ) {
332 if ( defined( $ns[
'constant'] ) ) {
335 $id = constant( $ns[
'constant'] );
338 $this->defines[ $ns[
'constant'] ] = $id;
341 if ( !( isset( $ns[
'conditional'] ) && $ns[
'conditional'] ) ) {
343 $this->attributes[
'ExtensionNamespaces'][$id] = $ns[
'name'];
345 if ( isset( $ns[
'gender'] ) ) {
346 $this->
globals[
'wgExtraGenderNamespaces'][$id] = $ns[
'gender'];
348 if ( isset( $ns[
'subpages'] ) && $ns[
'subpages'] ) {
349 $this->
globals[
'wgNamespacesWithSubpages'][$id] =
true;
351 if ( isset( $ns[
'content'] ) && $ns[
'content'] ) {
352 $this->
globals[
'wgContentNamespaces'][] = $id;
354 if ( isset( $ns[
'defaultcontentmodel'] ) ) {
355 $this->
globals[
'wgNamespaceContentModels'][$id] = $ns[
'defaultcontentmodel'];
357 if ( isset( $ns[
'protection'] ) ) {
358 $this->
globals[
'wgNamespaceProtection'][$id] = $ns[
'protection'];
360 if ( isset( $ns[
'capitallinkoverride'] ) ) {
361 $this->
globals[
'wgCapitalLinkOverrides'][$id] = $ns[
'capitallinkoverride'];
368 $defaultPaths = $info[
'ResourceFileModulePaths'] ??
false;
369 if ( isset( $defaultPaths[
'localBasePath'] ) ) {
370 if ( $defaultPaths[
'localBasePath'] ===
'' ) {
372 $defaultPaths[
'localBasePath'] = $dir;
374 $defaultPaths[
'localBasePath'] =
"$dir/{$defaultPaths['localBasePath']}";
378 foreach ( [
'ResourceModules',
'ResourceModuleSkinStyles' ]
as $setting ) {
379 if ( isset( $info[$setting] ) ) {
380 foreach ( $info[$setting]
as $name => $data ) {
381 if ( isset( $data[
'localBasePath'] ) ) {
382 if ( $data[
'localBasePath'] ===
'' ) {
384 $data[
'localBasePath'] = $dir;
386 $data[
'localBasePath'] =
"$dir/{$data['localBasePath']}";
389 if ( $defaultPaths ) {
390 $data += $defaultPaths;
399 if ( isset( $info[
'ExtensionMessagesFiles'] ) ) {
400 foreach ( $info[
'ExtensionMessagesFiles']
as &$file ) {
401 $file =
"$dir/$file";
403 $this->
globals[
"wgExtensionMessagesFiles"] += $info[
'ExtensionMessagesFiles'];
415 if ( isset( $info[
'MessagesDirs'] ) ) {
416 foreach ( $info[
'MessagesDirs']
as $name => $files ) {
417 foreach ( (
array)$files
as $file ) {
418 $this->
globals[
"wgMessagesDirs"][
$name][] =
"$dir/$file";
433 'type' => $info[
'type'] ??
'other',
435 foreach ( self::$creditsAttributes
as $attr ) {
436 if ( isset( $info[$attr] ) ) {
445 if ( isset( $this->credits[
$name] ) ) {
446 $firstPath = $this->credits[
$name][
'path'];
448 throw new Exception(
"It was attempted to load $name twice, from $firstPath and $secondPath." );
464 if ( isset( $info[
'config'] ) ) {
465 if ( isset( $info[
'config'][
'_prefix'] ) ) {
466 $prefix = $info[
'config'][
'_prefix'];
467 unset( $info[
'config'][
'_prefix'] );
471 foreach ( $info[
'config']
as $key => $val ) {
472 if ( $key[0] !==
'@' ) {
487 if ( isset( $info[
'config_prefix'] ) ) {
488 $prefix = $info[
'config_prefix'];
492 if ( isset( $info[
'config'] ) ) {
493 foreach ( $info[
'config']
as $key => $data ) {
495 if ( isset( $data[
'merge_strategy'] ) ) {
498 if ( isset( $data[
'path'] ) && $data[
'path'] ) {
502 $data[
'providedby'] = $info[
'name'];
503 if ( isset( $info[
'ConfigRegistry'][0] ) ) {
504 $data[
'configregistry'] = array_keys( $info[
'ConfigRegistry'] )[0];
506 $this->config[$key] = $data;
519 if ( array_key_exists( $key, $this->
globals ) ) {
520 throw new RuntimeException(
521 "The configuration setting '$key' was already set by MediaWiki core or"
522 .
" another extension, and cannot be set again by $extName." );
529 $this->
globals[$global][] =
"$dir/$path";
541 if ( !is_array(
$value ) ) {
542 throw new InvalidArgumentException(
"The value for '$name' should be an array (from $path)" );
544 if ( isset( $array[
$name] ) ) {
553 if ( isset( $info[
'load_composer_autoloader'] ) && $info[
'load_composer_autoloader'] ===
true ) {
554 $paths[] =
"$dir/vendor/autoload.php";
getRequirements(array $info)
Get the requirements for the provided 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.
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.
addConfigGlobal( $key, $value, $extName)
Helper function to set a value to a specific global, if it isn't set already.
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)
extractPathBasedGlobal( $global, $dir, $paths)
extractConfig2(array $info, $dir)
Set configuration settings for manifest_version == 2.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
array $globals
Stuff that is going to be set to $GLOBALS.
getExtraAutoloaderPaths( $dir, array $info)
Get the path for additional autoloaders, e.g.
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
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.