11 'ResourceLoaderSources',
12 'ResourceLoaderLESSVars',
18 'GrantPermissionGroups',
21 'GroupsRemoveFromSelf',
28 'AuthManagerAutoConfig',
29 'CentralIdLookupProviders',
30 'ChangeCredentialsBlacklist',
31 'RemoveCredentialsBlacklist',
36 'ExtensionEntryPointListFiles',
65 'wgGroupPermissions' =>
'array_plus_2d',
66 'wgRevokePermissions' =>
'array_plus_2d',
67 'wgGrantPermissions' =>
'array_plus_2d',
68 'wgHooks' =>
'array_merge_recursive',
69 'wgExtensionCredits' =>
'array_merge_recursive',
70 'wgExtraGenderNamespaces' =>
'array_plus',
71 'wgNamespacesWithSubpages' =>
'array_plus',
72 'wgNamespaceContentModels' =>
'array_plus',
73 'wgNamespaceProtection' =>
'array_plus',
74 'wgCapitalLinkOverrides' =>
'array_plus',
75 'wgRateLimits' =>
'array_plus_2d',
76 'wgAuthManagerAutoConfig' =>
'array_plus_2d',
105 'ResourceFileModulePaths',
107 'ResourceModuleSkinStyles',
108 'ExtensionMessagesFiles',
113 'ServiceWiringFiles',
117 'load_composer_autoloader',
128 'wgExtensionMessagesFiles' => [],
129 'wgMessagesDirs' => [],
177 if ( isset( $info[
'callback'] ) ) {
178 $this->callbacks[
$name] = $info[
'callback'];
181 foreach ( $info
as $key => $val ) {
182 if ( in_array( $key, self::$globalSettings ) ) {
185 } elseif ( $key[0] !==
'@' && !in_array( $key, self::$notAttributes )
186 && !in_array( $key, self::$creditsAttributes )
195 foreach ( $this->
globals as $key => $val ) {
196 if ( isset( self::$mergeStrategies[$key] ) ) {
213 if ( isset( $info[
'requires'][$key] ) ) {
214 $requirements[$key] = $info[
'requires'][$key];
217 return $requirements;
221 if ( isset( $info[
'Hooks'] ) ) {
223 if ( is_array(
$value ) ) {
240 if ( isset( $info[
'namespaces'] ) ) {
241 foreach ( $info[
'namespaces']
as $ns ) {
242 if ( defined( $ns[
'constant'] ) ) {
245 $id = constant( $ns[
'constant'] );
248 $this->defines[ $ns[
'constant'] ] = $id;
251 if ( !( isset( $ns[
'conditional'] ) && $ns[
'conditional'] ) ) {
253 $this->attributes[
'ExtensionNamespaces'][$id] = $ns[
'name'];
255 if ( isset( $ns[
'gender'] ) ) {
256 $this->
globals[
'wgExtraGenderNamespaces'][$id] = $ns[
'gender'];
258 if ( isset( $ns[
'subpages'] ) && $ns[
'subpages'] ) {
259 $this->
globals[
'wgNamespacesWithSubpages'][$id] =
true;
261 if ( isset( $ns[
'content'] ) && $ns[
'content'] ) {
262 $this->
globals[
'wgContentNamespaces'][] = $id;
264 if ( isset( $ns[
'defaultcontentmodel'] ) ) {
265 $this->
globals[
'wgNamespaceContentModels'][$id] = $ns[
'defaultcontentmodel'];
267 if ( isset( $ns[
'protection'] ) ) {
268 $this->
globals[
'wgNamespaceProtection'][$id] = $ns[
'protection'];
270 if ( isset( $ns[
'capitallinkoverride'] ) ) {
271 $this->
globals[
'wgCapitalLinkOverrides'][$id] = $ns[
'capitallinkoverride'];
278 $defaultPaths = isset( $info[
'ResourceFileModulePaths'] )
279 ? $info[
'ResourceFileModulePaths']
281 if ( isset( $defaultPaths[
'localBasePath'] ) ) {
282 if ( $defaultPaths[
'localBasePath'] ===
'' ) {
284 $defaultPaths[
'localBasePath'] =
$dir;
286 $defaultPaths[
'localBasePath'] =
"$dir/{$defaultPaths['localBasePath']}";
290 foreach ( [
'ResourceModules',
'ResourceModuleSkinStyles' ]
as $setting ) {
291 if ( isset( $info[$setting] ) ) {
292 foreach ( $info[$setting]
as $name => $data ) {
293 if ( isset( $data[
'localBasePath'] ) ) {
294 if ( $data[
'localBasePath'] ===
'' ) {
296 $data[
'localBasePath'] =
$dir;
298 $data[
'localBasePath'] =
"$dir/{$data['localBasePath']}";
301 if ( $defaultPaths ) {
302 $data += $defaultPaths;
311 if ( isset( $info[
'ExtensionMessagesFiles'] ) ) {
312 $this->
globals[
"wgExtensionMessagesFiles"] += array_map(
function( $file )
use (
$dir ) {
314 }, $info[
'ExtensionMessagesFiles'] );
326 if ( isset( $info[
'MessagesDirs'] ) ) {
329 $this->
globals[
"wgMessagesDirs"][
$name][] =
"$dir/$file";
344 'type' => isset( $info[
'type'] ) ? $info[
'type'] :
'other',
346 foreach ( self::$creditsAttributes
as $attr ) {
347 if ( isset( $info[$attr] ) ) {
356 if ( isset( $this->credits[
$name] ) ) {
357 $firstPath = $this->credits[
$name][
'path'];
359 throw new Exception(
"It was attempted to load $name twice, from $firstPath and $secondPath." );
375 if ( isset( $info[
'config'] ) ) {
376 if ( isset( $info[
'config'][
'_prefix'] ) ) {
377 $prefix = $info[
'config'][
'_prefix'];
378 unset( $info[
'config'][
'_prefix'] );
382 foreach ( $info[
'config']
as $key => $val ) {
383 if ( $key[0] !==
'@' ) {
384 $this->
globals[
"$prefix$key"] = $val;
391 if ( isset( $info[
'ServiceWiringFiles'] ) ) {
392 foreach ( $info[
'ServiceWiringFiles']
as $path ) {
393 $this->
globals[
'wgServiceWiringFiles'][] =
"$dir/$path";
399 if ( isset( $info[
'ParserTestFiles'] ) ) {
400 foreach ( $info[
'ParserTestFiles']
as $path ) {
401 $this->
globals[
'wgParserTestFiles'][] =
"$dir/$path";
414 if ( !is_array(
$value ) ) {
417 if ( isset( $array[
$name] ) ) {
418 $array[
$name] = array_merge_recursive( $array[$name],
$value );
426 if ( isset( $info[
'load_composer_autoloader'] ) && $info[
'load_composer_autoloader'] ===
true ) {
427 $path =
"$dir/vendor/autoload.php";
428 if ( file_exists(
$path ) ) {
array $globals
Stuff that is going to be set to $GLOBALS.
static array $mergeStrategies
Mapping of global settings to their specific merge strategies.
extractResourceLoaderModules($dir, array $info)
the array() calling protocol came about after MediaWiki 1.4rc1.
extractParserTestFiles($dir, array $info)
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
extractCredits($path, array $info)
const MERGE_STRATEGY
Special key that defines the merge strategy.
static array $notAttributes
Things that are not 'attributes', but are not in $globalSettings or $creditsAttributes.
extractConfig(array $info)
Set configuration settings.
storeToArray($path, $name, $value, &$array)
callable[] $callbacks
Things to be called once registration of these extensions are done keyed by the name of the extension...
extractInfo($path, array $info, $version)
extractHooks(array $info)
const MEDIAWIKI_CORE
"requires" key that applies to MediaWiki core/$wgVersion
static array $globalSettings
Keys that should be set to $GLOBALS.
getExtraAutoloaderPaths($dir, array $info)
Get the path for additional autoloaders, e.g.
array $attributes
Any thing else in the $info that hasn't already been processed.
extractServiceWiringFiles($dir, 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
getRequirements(array $info)
Get the requirements for the provided info.
extractExtensionMessagesFiles($dir, array $info)
static array static array $creditsAttributes
Keys that are part of the extension credits.
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
array array $defines
Things that should be define()'d.
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.
extractMessagesDirs($dir, array $info)
Set message-related settings, which need to be expanded to use absolute paths.
extractNamespaces(array $info)
Register namespaces with the appropriate global settings.
Allows to change the fields on the form that will be generated $name