19 'AuthManagerAutoConfig',
21 'CentralIdLookupProviders',
22 'ChangeCredentialsBlacklist',
26 'ExtensionEntryPointListFiles',
31 'GrantPermissionGroups',
35 'GroupsRemoveFromSelf',
51 'RemoveCredentialsBlacklist',
53 'ResourceLoaderSources',
78 'wgAuthManagerAutoConfig' =>
'array_plus_2d',
79 'wgCapitalLinkOverrides' =>
'array_plus',
80 'wgExtensionCredits' =>
'array_merge_recursive',
81 'wgExtraGenderNamespaces' =>
'array_plus',
82 'wgGrantPermissions' =>
'array_plus_2d',
83 'wgGroupPermissions' =>
'array_plus_2d',
84 'wgHooks' =>
'array_merge_recursive',
85 'wgNamespaceContentModels' =>
'array_plus',
86 'wgNamespaceProtection' =>
'array_plus',
87 'wgNamespacesWithSubpages' =>
'array_plus',
88 'wgPasswordPolicy' =>
'array_merge_recursive',
89 'wgRateLimits' =>
'array_plus_2d',
90 'wgRevokePermissions' =>
'array_plus_2d',
119 'ResourceFileModulePaths',
121 'ResourceModuleSkinStyles',
123 'ExtensionMessagesFiles',
128 'ServiceWiringFiles',
132 'load_composer_autoloader',
143 'wgExtensionMessagesFiles' => [],
144 'wgMessagesDirs' => [],
194 $dir = dirname(
$path );
200 if ( isset( $info[
'ServiceWiringFiles'] ) ) {
202 'wgServiceWiringFiles',
204 $info[
'ServiceWiringFiles']
207 if ( isset( $info[
'ParserTestFiles'] ) ) {
211 $info[
'ParserTestFiles']
215 if ( isset( $info[
'callback'] ) ) {
216 $this->callbacks[
$name] = $info[
'callback'];
221 if ( $version === 2 ) {
228 if ( $version === 2 ) {
232 foreach ( $info
as $key => $val ) {
234 if ( in_array( $key, self::$globalSettings ) ) {
239 if ( $key[0] ===
'@' ) {
243 if ( $version === 2 ) {
245 if ( in_array( $key, self::$coreAttributes ) ) {
250 if ( !in_array( $key, self::$notAttributes )
251 && !in_array( $key, self::$creditsAttributes )
266 if ( isset( $info[
'attributes'] ) ) {
267 foreach ( $info[
'attributes']
as $extName =>
$value ) {
275 foreach ( $this->
globals as $key => $val ) {
276 if ( isset( self::$mergeStrategies[$key] ) ) {
282 foreach ( $this->extAttributes
as $extName =>
$value ) {
284 if ( isset( $this->credits[$extName] ) ) {
285 foreach (
$value as $attrName => $attrValue ) {
288 $extName . $attrName,
293 unset( $this->extAttributes[$extName] );
308 return $info[
'requires'] ?? [];
312 if ( isset( $info[
'Hooks'] ) ) {
314 if ( is_array(
$value ) ) {
331 if ( isset( $info[
'namespaces'] ) ) {
332 foreach ( $info[
'namespaces']
as $ns ) {
333 if ( defined( $ns[
'constant'] ) ) {
336 $id = constant( $ns[
'constant'] );
339 $this->defines[ $ns[
'constant'] ] = $id;
342 if ( !( isset( $ns[
'conditional'] ) && $ns[
'conditional'] ) ) {
344 $this->attributes[
'ExtensionNamespaces'][$id] = $ns[
'name'];
346 if ( isset( $ns[
'gender'] ) ) {
347 $this->
globals[
'wgExtraGenderNamespaces'][$id] = $ns[
'gender'];
349 if ( isset( $ns[
'subpages'] ) && $ns[
'subpages'] ) {
350 $this->
globals[
'wgNamespacesWithSubpages'][$id] =
true;
352 if ( isset( $ns[
'content'] ) && $ns[
'content'] ) {
353 $this->
globals[
'wgContentNamespaces'][] = $id;
355 if ( isset( $ns[
'defaultcontentmodel'] ) ) {
356 $this->
globals[
'wgNamespaceContentModels'][$id] = $ns[
'defaultcontentmodel'];
358 if ( isset( $ns[
'protection'] ) ) {
359 $this->
globals[
'wgNamespaceProtection'][$id] = $ns[
'protection'];
361 if ( isset( $ns[
'capitallinkoverride'] ) ) {
362 $this->
globals[
'wgCapitalLinkOverrides'][$id] = $ns[
'capitallinkoverride'];
369 $defaultPaths = $info[
'ResourceFileModulePaths'] ??
false;
370 if ( isset( $defaultPaths[
'localBasePath'] ) ) {
371 if ( $defaultPaths[
'localBasePath'] ===
'' ) {
373 $defaultPaths[
'localBasePath'] = $dir;
375 $defaultPaths[
'localBasePath'] =
"$dir/{$defaultPaths['localBasePath']}";
379 foreach ( [
'ResourceModules',
'ResourceModuleSkinStyles' ]
as $setting ) {
380 if ( isset( $info[$setting] ) ) {
382 if ( isset(
$data[
'localBasePath'] ) ) {
383 if (
$data[
'localBasePath'] ===
'' ) {
385 $data[
'localBasePath'] = $dir;
387 $data[
'localBasePath'] =
"$dir/{$data['localBasePath']}";
390 if ( $defaultPaths ) {
391 $data += $defaultPaths;
398 if ( isset( $info[
'QUnitTestModule'] ) ) {
399 $data = $info[
'QUnitTestModule'];
400 if ( isset(
$data[
'localBasePath'] ) ) {
401 if (
$data[
'localBasePath'] ===
'' ) {
403 $data[
'localBasePath'] = $dir;
405 $data[
'localBasePath'] =
"$dir/{$data['localBasePath']}";
408 $this->attributes[
'QUnitTestModules'][
"test.{$info['name']}"] =
$data;
413 if ( isset( $info[
'ExtensionMessagesFiles'] ) ) {
414 foreach ( $info[
'ExtensionMessagesFiles']
as &
$file ) {
415 $file =
"$dir/$file";
417 $this->
globals[
"wgExtensionMessagesFiles"] += $info[
'ExtensionMessagesFiles'];
429 if ( isset( $info[
'MessagesDirs'] ) ) {
430 foreach ( $info[
'MessagesDirs']
as $name => $files ) {
432 $this->
globals[
"wgMessagesDirs"][
$name][] =
"$dir/$file";
447 'type' => $info[
'type'] ??
'other',
449 foreach ( self::$creditsAttributes
as $attr ) {
450 if ( isset( $info[$attr] ) ) {
459 if ( isset( $this->credits[
$name] ) ) {
460 $firstPath = $this->credits[
$name][
'path'];
462 throw new Exception(
"It was attempted to load $name twice, from $firstPath and $secondPath." );
478 if ( isset( $info[
'config'] ) ) {
479 if ( isset( $info[
'config'][
'_prefix'] ) ) {
480 $prefix = $info[
'config'][
'_prefix'];
481 unset( $info[
'config'][
'_prefix'] );
485 foreach ( $info[
'config']
as $key => $val ) {
486 if ( $key[0] !==
'@' ) {
501 $prefix = $info[
'config_prefix'] ??
'wg';
502 if ( isset( $info[
'config'] ) ) {
503 foreach ( $info[
'config']
as $key =>
$data ) {
505 if ( isset(
$data[
'merge_strategy'] ) ) {
508 if ( isset(
$data[
'path'] ) &&
$data[
'path'] ) {
512 $data[
'providedby'] = $info[
'name'];
513 if ( isset( $info[
'ConfigRegistry'][0] ) ) {
514 $data[
'configregistry'] = array_keys( $info[
'ConfigRegistry'] )[0];
516 $this->config[$key] =
$data;
529 if ( array_key_exists( $key, $this->
globals ) ) {
530 throw new RuntimeException(
531 "The configuration setting '$key' was already set by MediaWiki core or"
532 .
" another extension, and cannot be set again by $extName." );
539 $this->
globals[$global][] =
"$dir/$path";
551 if ( !is_array(
$value ) ) {
552 throw new InvalidArgumentException(
"The value for '$name' should be an array (from $path)" );
554 if ( isset( $array[
$name] ) ) {
563 if ( isset( $info[
'load_composer_autoloader'] ) && $info[
'load_composer_autoloader'] ===
true ) {
564 $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', and 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.
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
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
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
Allows to change the fields on the form that will be generated $name
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
Processors read associated arrays and register whatever is required.
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))
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file