Jump to content

Manual:Extension.json/Schema: Difference between revisions

From mediawiki.org
Content deleted Content added
Timmay911 (talk | contribs)
Completed schema outline, will add details tomorrow
Timmay911 (talk | contribs)
Completed schema outline details, added See Also links.
Line 1: Line 1:
This page documents the schema used by extension.json. All fields are optional unless otherwise specified. It is currently incomplete.
This page documents the schema used by extension.json. All fields are optional unless otherwise specified. It is currently incomplete.


== name ==
== ==
=== manifest_version ===
{{MW 1.25|and after}}
{{TNT|MW version|version=1.25|comment=and after}}

'''This field is required.'''

This is the extension's canonical name. It should not be changed once set, as it is used as an API for other extensions to detect what is installed.<syntaxhighlight lang="json">
{
"name": "FooBar"
}
</syntaxhighlight>

== manifest_version ==
{{MW 1.25|and after}}


'''This field is required.'''
'''This field is required.'''
Line 27: Line 17:
</syntaxhighlight>Note: This field is typically placed at the bottom of extension.json files.
</syntaxhighlight>Note: This field is typically placed at the bottom of extension.json files.


== namemsg ==
== ==
{{MW 1.25|and after}}
{{MW 1.25|and after}}

'''This field is required.'''

This is the extension's canonical name. It should not be changed once set, as it is used as an API for other extensions to detect what is installed.<syntaxhighlight lang="json">
{
"name": "FooBar"
}
</syntaxhighlight>

=== namemsg ===
{{TNT|MW version|version=1.25|comment=and after}}


A localized version of the extension's name. Typically the message key is named in the format <name>-extensionname or <name>-skinname.<syntaxhighlight lang="json">
A localized version of the extension's name. Typically the message key is named in the format <name>-extensionname or <name>-skinname.<syntaxhighlight lang="json">
Line 36: Line 37:
</syntaxhighlight>
</syntaxhighlight>


== type ==
== type ==
{{MW 1.25|and after}}
{{MW 1.25|and after}}


The type of extension it is, for sorting on Special:Version. The following types are supported:
The type of extension it is, for sorting on Special:Version. The following types are supported:
Line 54: Line 55:
</syntaxhighlight>
</syntaxhighlight>


== author ==
== author ==
{{MW 1.25|and after}}
{{MW 1.25|and after}}


The authors of the extension, may contain wikitext. This can either be a single string, or a list of strings. Additionally, the special string <code>...</code> may be used to add a generic "and others" suffix using the <code>version-poweredby-others</code> message.
The authors of the extension, may contain wikitext. This can either be a single string, or a list of strings. Additionally, the special string <code>...</code> may be used to add a generic "and others" suffix using the <code>version-poweredby-others</code> message.


== version ==
== version ==
{{MW 1.25|and after}}
{{MW 1.25|and after}}


The current version of the extension. Should be in a format supported by [https://getcomposer.org/doc/articles/versions.md composer].
The current version of the extension. Should be in a format supported by [https://getcomposer.org/doc/articles/versions.md composer].


== url ==
== url ==
{{MW 1.25|and after}}
{{MW 1.25|and after}}


URL to the extension's "homepage" or documentation. Typically points to <code><nowiki>https://www.mediawiki.org/wiki/Extension</nowiki>:<extensionname></code>.
URL to the extension's "homepage" or documentation. Typically points to <code><nowiki>https://www.mediawiki.org/wiki/Extension</nowiki>:<extensionname></code>.


== description ==
== description ==
{{MW 1.25|and after}}
{{MW 1.25|and after}}


Description of the extension, may contain wikitext. Note: it is recommended to use descriptionmsg instead.
Description of the extension, may contain wikitext. Note: it is recommended to use descriptionmsg instead.


== descriptionmsg ==
== descriptionmsg ==
{{MW 1.25|and after}}
{{MW 1.25|and after}}


Localization message key for the extension's description, typically in the format <extensionname>-desc. This will override description.
Localization message key for the extension's description, typically in the format <extensionname>-desc. This will override description.


== license-name ==
== license-name ==
{{MW 1.25|and after}}
{{MW 1.25|and after}}
The [https://spdx.org/licenses/ SPDX license identifier] for the license the source code is licensed as. If you create a file named "COPYING" in the extension root directory with the contents of the license, it will also be linked and visible from Special:Version.
The [https://spdx.org/licenses/ SPDX license identifier] for the license the source code is licensed as. If you create a file named "COPYING" in the extension root directory with the contents of the license, it will also be linked and visible from Special:Version.


== requires ==
== requires ==
{{MW 1.29|and after}}
{{MW 1.29|and after}}


The requires section allows you to document dependencies on versions of MediaWiki core and other extensions.<syntaxhighlight lang="json">
The requires section allows you to document dependencies on versions of MediaWiki core and other extensions.<syntaxhighlight lang="json">
Line 98: Line 99:
</syntaxhighlight>You can use any version specifier that [https://getcomposer.org/doc/articles/versions.md composer supports]. For MediaWiki, it is best practice to specify a >= for the minimum supported version, unless you know a future version is explicitly broken. For extensions, if they don't have a version specifier set, or don't use a versioning system, use a plain * to indicate any version is acceptable.
</syntaxhighlight>You can use any version specifier that [https://getcomposer.org/doc/articles/versions.md composer supports]. For MediaWiki, it is best practice to specify a >= for the minimum supported version, unless you know a future version is explicitly broken. For extensions, if they don't have a version specifier set, or don't use a versioning system, use a plain * to indicate any version is acceptable.


=== ResourceFileModulePaths ===
== config ==
Specifies the default paths to use for all ResourceLoader file modules.
{{MW 1.25|and after}}

The allowed properties are:
* <code>localBasePath</code>
* <code>remoteExtPath</code>
* <code>remoteSkinPath</code>

These correspond to the same options in each module definition in <code>ResourceModules</code>. If a value is not specified in the module definition, the default value specified here will be used. <syntaxhighlight lang="json">
{
"ResourceFileModulePaths": {
"localBasePath": "resources",
"remoteExtPath": "FooBar/resources"
}
}
</syntaxhighlight>

=== ResourceModules ===
{{see global|ResourceModules|desc=ResourceLoader modules to register.}}

=== ResourceModuleSkinStyles ===
{{see global|ResourceModuleSkinStyles|desc=ResourceLoader modules for custom skin styles.}}

=== ResourceLoaderSources ===
{{see global|ResourceLoaderSources|desc=ResourceLoader sources to register.}}

=== ResourceLoaderLESSVars ===
ResourceLoader LESS variables.

=== ConfigRegistry ===
{{see global|ConfigRegistry|desc=Registry of factory functions to create Config objects.}}

=== SessionProviders ===
{{see global|SessionProviders|desc=Session providers}}

=== AuthManagerAutoConfig ===
{{see global|AuthManagerAutoConfig|desc=AuthManager auto-configuration.}}

The following properties are available:
* <code>preauth</code>: Pre-authentication providers.
* <code>primaryauth</code>: Primary authentication providers.
* <code>secondaryauth</code>: Secondary authentication providers.

=== CentralIdLookupProviders ===
{{see global|CentralIdLookupProviders|desc=Central ID lookup providers.}}

=== ChangeCredentialsBlacklist ===
{{see global|ChangeCredentialsBlacklist|desc=AuthenticationRequest classes which can only be used internally for credential change.}}

=== RemoveCredentialsBlacklist ===
{{see global|RemoveCredentialsBlacklist|desc=AuthenticationRequest classes which can only be used internally for credential removal.}}

=== namespaces ===
Method to add extra namespaces.

The following properties are available:
* <code>id</code>: An integer.
* <code>constant</code>: A string.
* <code>name</code>: A string.
* <code>gender</code>: Gender object. Properties are either "male" or "female."
* <code>subpages</code>: Boolean. Default is <code>false</code>.
* <code>content</code>: Boolean. Default is <code>false</code>.
* <code>defaultcontentmodel</code>: A string.
* <code>protection</code>: Userright(s) required to edit in this namespace. An array or string.
* <code>capitallinkoverride</code>: Set $wgCapitalLinks on a per-namespace basis. Boolean.
* <code>conditional</code>: Whether the namespace is conditional upon configuration and should not be registered (requires separate registration via a hook). Boolean. Default is <code>false</code>.

=== TrackingCategories ===
{{see global|TrackingCategories|desc=Tracking category message keys.}}

=== DefaultUserOption ===
{{see global|DefaultUserOption|desc=}}

=== HiddenPrefs ===
{{see global|HiddenPrefs|desc=Preferences users cannot set.}}

=== GroupPermissions ===
{{see global|GroupPermissions|desc=Default permissions to give to user groups.}}

=== RevokePermissions ===
{{see global|RevokePermissions|desc=Default permissions to revoke from user groups.}}

=== GrantPermissions ===
{{see global|GrantPermissions|desc=Map of permissions granted to authorized consumers to their bundles, called 'grants.'}}

=== GrantPermissionGroups ===
{{see global|GrantPermissionGroups|desc=Map of grants to their UI grouping.}}

=== ImplicitGroups ===
{{see global|ImplicitGroups|desc=Implicit groups.}}

=== GroupsAddToSelf ===
{{see global|GroupsAddToSelf|desc=Groups a user can add to themselves.}}

=== GroupsRemoveFromSelf ===
{{see global|GroupsRemoveFromSelf|desc=Groups a user can remove from themselves.}}

=== AddGroups ===
{{see global|AddGroups|desc=Groups a user can add to users.}}

=== RemoveGroups ===
{{see global|RemoveGroups|desc=Groups a user can remove from users.}}

=== AvailableRights ===
{{see global|AvailableRights|desc=User rights added by the extension.}}

=== ContentHandlers ===
{{see global|ContentHandlers|desc=Mapping of Model ID to class name.}}

=== RateLimits ===
{{see global|RateLimits|desc=Rate limis.}}

=== RecentChangesFlags ===
Flags (letter symbols) down on RecentChanges pages.

=== MediaHandlers ===
{{see global|MediaHandlers|desc=Plugins for media file type handling. Each entry in the array map maps a MIME type to a PHP class name.}}

=== ExtensionFunctions ===
{{see global|ExtensionFunctions|desc=Function to call after setup has finished.}}

=== ExtensionMessagesFiles ===
{{see global|ExtensionMessagesFiles|desc=File paths containing PHP internationalization files.}}

=== MessageDirs ===
{{see global|MessagesDirs|desc=Directory paths containing JSON internationalization data.}}

=== ExtensionEntryPointListFiles ===
An object.

=== SpecialPages ===
{{see global|SpecialPages|desc=SpecialPages implemented in this extension (mapping of page name to class name).}}

=== AutoloadClasses ===
{{see global|AutoloadClasses|desc=An object.}}

=== Hooks ===
{{see global|Hooks|desc=Hooks this extension uses (mapping of hook name to callback).}}

=== JobClasses ===
{{see global|JobClasses|desc=Job types this extension implements (mapping of job types to class name).}}

=== LogTypes ===
{{see global|LogTypes|desc=List of new log types this extension uses.}}

=== LogRestrictions ===
{{see global|LogRestrictions|desc=An object.}}

=== FilterLogTypes ===
{{see global|FilterLogTypes|desc=An object.}}

=== ActionFilteredLogs ===
{{see global|ActionFilteredLogs|desc=List of log types which can be filtered by log actions.}}

=== LogNames ===
{{see global|LogNames|desc=An object.}}

=== LogHeaders ===
{{see global|LogHeaders|desc=An object.}}

=== LogActions ===
{{see global|LogActions|desc=An object.}}

=== LogActionsHandlers ===
{{see global|LogActionsHandlers|desc=An object.}}

=== Actions ===
{{see global|Actions|desc=An object.}}

=== APIModules ===
{{see global|APIModules|desc=An object.}}

=== APIFormatModules ===
{{see global|APIFormatModules|desc=An object.}}

=== APIMetaModules ===
{{see global|APIMetaModules|desc=An object.}}

=== APIPropModules ===
{{see global|APIPropModules|desc=An object.}}

=== APIListModules ===
{{see global|APIListModules|desc=An object.}}

=== ValidSkinNames ===
{{see global|ValidSkinNames|desc=An object.}}

=== FeedClasses ===
{{see global|FeedClasses|desc=Available feed objects.}}

=== SkinOOUIThemes ===
An object.

=== PasswordPolicy ===
{{see global|PasswordPolicy|desc=Password policies.}}

=== FileExtensions ===
{{see global|FileExtensions|desc=Preferred file extensions for uploading.}}

=== callback ===
A function to be called right after MediaWiki processes this file.

=== config ===
{{TNT|MW version|version=1.25|comment=and after}}


The config section is where you can define configuration settings that sysadmins can change to configure the extension. This section should only be used for things that are configured in LocalSettings.php - if it is supposed to be modified by other extensions, you should use [[Manual:Extension registration#Attributes|attributes]], or if it is just class metadata, use a private static variable or something like that. The format of config changed in manifest_version 2, this documentation covers its usage in manifest_version 1.
The config section is where you can define configuration settings that sysadmins can change to configure the extension. This section should only be used for things that are configured in LocalSettings.php - if it is supposed to be modified by other extensions, you should use [[Manual:Extension registration#Attributes|attributes]], or if it is just class metadata, use a private static variable or something like that. The format of config changed in manifest_version 2, this documentation covers its usage in manifest_version 1.
Line 138: Line 341:
</syntaxhighlight>The first setting, <code>$wgFooBarEnabledNamespaces</code>, has keys that are numbers, so PHP will turn them into integers, even though they are strings in JSON. Because of how PHP treats integer keys when merging arrays, we need to use a different type of merge here, so we set a different "merge strategy" using the magic key. In the second example, we have a nested array, which requires a different type of merging, since we want to allow people to continue writing <code>$wgFooBarCoolStuff['user']['foo'] = true;</code> in their LocalSettings.php.
</syntaxhighlight>The first setting, <code>$wgFooBarEnabledNamespaces</code>, has keys that are numbers, so PHP will turn them into integers, even though they are strings in JSON. Because of how PHP treats integer keys when merging arrays, we need to use a different type of merge here, so we set a different "merge strategy" using the magic key. In the second example, we have a nested array, which requires a different type of merging, since we want to allow people to continue writing <code>$wgFooBarCoolStuff['user']['foo'] = true;</code> in their LocalSettings.php.


=== Merge strategies ===
=== Merge strategies ===
The following merge strategies are available:
The following merge strategies are available:
* <code>array_merge</code>: Default, does not need to be explicitly set. Any keys that are integers will be re-numbered when merging.
* <code>array_merge</code>: Default, does not need to be explicitly set. Any keys that are integers will be re-numbered when merging.
Line 146: Line 349:
* <code>array_replace_recursive</code>: TODO why should this be used?
* <code>array_replace_recursive</code>: TODO why should this be used?


== ResourceModules ==
== ==
Prefix to put in front of configuration settings when exporting them to $GLOBALS.
{{see global|ResourceModules|desc=ResourceLoader modules to register.}}

=== ParserTestFiles ===
{{see global|ParserTestFiles|desc=Parser test suite files to be run by parserTests.php when no specific filename is passed to it.}}

=== ServiceWiringFiles ===
List of service wiring files to be loaded by the default instance of MediaWikiServices.

=== load_composer_autoloader ===
Load the composer autoloader for this extension, if one is present.

== See Also ==
* [extension.schema.v2.json|This page documents the schema used by extension.json. All fields are optional unless otherwise specified. It is currently incomplete.

== Schema ==
=== manifest_version ===
{{TNT|MW version|version=1.25|comment=and after}}

'''This field is required.'''

This specifies the version of the extension.json file format that is being used. In the future if breaking changes are made to the file format, this number will be incremented to continue supporting extensions using the older format.

* <code>1</code>: 1.25+
* <code>2</code>: 1.29+
<syntaxhighlight lang="json">
{
"manifest_version": 1
}
</syntaxhighlight>Note: This field is typically placed at the bottom of extension.json files.

=== name ===
{{TNT|MW version|version=1.25|comment=and after}}

'''This field is required.'''

This is the extension's canonical name. It should not be changed once set, as it is used as an API for other extensions to detect what is installed.<syntaxhighlight lang="json">
{
"name": "FooBar"
}
</syntaxhighlight>

=== namemsg ===
{{TNT|MW version|version=1.25|comment=and after}}

A localized version of the extension's name. Typically the message key is named in the format <name>-extensionname or <name>-skinname.<syntaxhighlight lang="json">
{
"namemsg": "foobar-extensionname"
}
</syntaxhighlight>

=== type ===
{{TNT|MW version|version=1.25|comment=and after}}

The type of extension it is, for sorting on Special:Version. The following types are supported:
* <code>api</code> — [[API:Extensions|API extensions]]
* <code>antispam</code> — [[:Category:Spam management extensions|antispam]] extensions
* <code>media</code> — [[:Category:Media handling extensions|media handlers]]
* <code>parserhook</code> — extensions that modify, add or replace functionality in the MediaWiki [[:Category:Parser extensions|parser]]
* <code>skin</code> — extensions that modify [[Special:MyLanguage/Manual:Skins|skins]]
* <code>specialpage</code> — extensions that add [[Special:MyLanguage/Manual:Special pages|special pages]]
* <code>variable</code> — make a new [[Special:MyLanguage/Manual:Variables|variable]]
* <code>other</code> — does something else
Note: custom types can be added by using the {{Hook|ExtensionTypes}} hook. If not set, the extension will default to the "other" section.<syntaxhighlight lang="json">
{
"type": "specialpage"
}
</syntaxhighlight>

=== author ===
{{TNT|MW version|version=1.25|comment=and after}}

The authors of the extension, may contain wikitext. This can either be a single string, or a list of strings. Additionally, the special string <code>...</code> may be used to add a generic "and others" suffix using the <code>version-poweredby-others</code> message.

=== version ===
{{TNT|MW version|version=1.25|comment=and after}}

The current version of the extension. Should be in a format supported by [https://getcomposer.org/doc/articles/versions.md composer].

=== url ===
{{TNT|MW version|version=1.25|comment=and after}}

URL to the extension's "homepage" or documentation. Typically points to <code><nowiki>https://www.mediawiki.org/wiki/Extension</nowiki>:<extensionname></code>.

=== description ===
{{TNT|MW version|version=1.25|comment=and after}}

Description of the extension, may contain wikitext. Note: it is recommended to use descriptionmsg instead.

=== descriptionmsg ===
{{TNT|MW version|version=1.25|comment=and after}}

Localization message key for the extension's description, typically in the format <extensionname>-desc. This will override description.

=== license-name ===
{{TNT|MW version|version=1.25|comment=and after}}
The [https://spdx.org/licenses/ SPDX license identifier] for the license the source code is licensed as. If you create a file named "COPYING" in the extension root directory with the contents of the license, it will also be linked and visible from Special:Version.

=== requires ===
{{TNT|MW version|version=1.29|comment=and after}}

The requires section allows you to document dependencies on versions of MediaWiki core and other extensions.<syntaxhighlight lang="json">
{
"requires": {
"MediaWiki": ">= 1.27.0",
"extensions": {
"FooBar": "*",
"Baz": ">= 1.2.3"
}
}
}
</syntaxhighlight>You can use any version specifier that [https://getcomposer.org/doc/articles/versions.md composer supports]. For MediaWiki, it is best practice to specify a >= for the minimum supported version, unless you know a future version is explicitly broken. For extensions, if they don't have a version specifier set, or don't use a versioning system, use a plain * to indicate any version is acceptable.


== ResourceFileModulePaths ==
== ResourceFileModulePaths ==
Specifies the default paths to use for all ResourceLoader file modules.
Specifies the default paths to use for all ResourceLoader file modules.


Line 166: Line 479:
</syntaxhighlight>
</syntaxhighlight>


=== ResourceModules ===
== ResourceModuleSkinStyles ==
{{see global|ResourceModules|desc=ResourceLoader modules to register.}}

=== ResourceModuleSkinStyles ===
{{see global|ResourceModuleSkinStyles|desc=ResourceLoader modules for custom skin styles.}}
{{see global|ResourceModuleSkinStyles|desc=ResourceLoader modules for custom skin styles.}}


== ResourceLoaderSources ==
== ResourceLoaderSources ==
{{see global|ResourceLoaderSources|desc=ResourceLoader sources to register.}}
{{see global|ResourceLoaderSources|desc=ResourceLoader sources to register.}}


== ResourceLoaderLESSVars ==
== ResourceLoaderLESSVars ==
{{see global|ResourceLoaderLESSVars|desc=ResourceLoader LESS variables.}}
ResourceLoader LESS variables.


== ConfigRegistry ==
== ConfigRegistry ==
{{see global|ConfigRegistry|desc=Registry of factory functions to create Config objects.}}
{{see global|ConfigRegistry|desc=Registry of factory functions to create Config objects.}}


== SessionProviders ==
== SessionProviders ==
{{see global|SessionProviders|desc=Session providers}}
{{see global|SessionProviders|desc=Session providers}}


== AuthManagerAutoConfig ==
== AuthManagerAutoConfig ==
{{see global|AuthManagerAutoConfig|desc=AuthManager auto-configuration.}}
{{see global|AuthManagerAutoConfig|desc=AuthManager auto-configuration.}}


The following properties are available:
== CentralIdLookupProviders ==
* <code>preauth</code>: Pre-authentication providers.
* <code>primaryauth</code>: Primary authentication providers.
* <code>secondaryauth</code>: Secondary authentication providers.

=== CentralIdLookupProviders ===
{{see global|CentralIdLookupProviders|desc=Central ID lookup providers.}}
{{see global|CentralIdLookupProviders|desc=Central ID lookup providers.}}


== ChangeCredentialsBlacklist ==
== ChangeCredentialsBlacklist ==
{{see global|ChangeCredentialsBlacklist|desc=AuthenticationRequest classes which can only be used internally for credential change.}}


== RemoveCredentialsBlacklist ==
== RemoveCredentialsBlacklist ==
{{see global|RemoveCredentialsBlacklist|desc=AuthenticationRequest classes which can only be used internally for credential removal.}}


== namespaces ==
== namespaces ==
Method to add extra namespaces.


The following properties are available:
== TrackingCategories ==
* <code>id</code>: An integer.
* <code>constant</code>: A string.
* <code>name</code>: A string.
* <code>gender</code>: Gender object. Properties are either "male" or "female."
* <code>subpages</code>: Boolean. Default is <code>false</code>.
* <code>content</code>: Boolean. Default is <code>false</code>.
* <code>defaultcontentmodel</code>: A string.
* <code>protection</code>: Userright(s) required to edit in this namespace. An array or string.
* <code>capitallinkoverride</code>: Set $wgCapitalLinks on a per-namespace basis. Boolean.
* <code>conditional</code>: Whether the namespace is conditional upon configuration and should not be registered (requires separate registration via a hook). Boolean. Default is <code>false</code>.


== DefaultUserOption ==
== ==
{{see global|TrackingCategories|desc=Tracking category message keys.}}


== HiddenPrefs ==
== ==
{{see global|DefaultUserOption|desc=}}


== GroupPermissions ==
== ==
{{see global|HiddenPrefs|desc=Preferences users cannot set.}}


== RevokePermissions ==
== ==
{{see global|GroupPermissions|desc=Default permissions to give to user groups.}}


== GrantPermissions ==
== ==
{{see global|RevokePermissions|desc=Default permissions to revoke from user groups.}}


=== GrantPermissions ===
== GrantPermissionsGroups ==
{{see global|GrantPermissions|desc=Map of permissions granted to authorized consumers to their bundles, called 'grants.'}}


== ImplicitGroups ==
== ==
{{see global|GrantPermissionGroups|desc=Map of grants to their UI grouping.}}


== GroupsAddToSelf ==
== ==
{{see global|ImplicitGroups|desc=Implicit groups.}}


== GroupsRemoveFromSelf ==
== ==
{{see global|GroupsAddToSelf|desc=Groups a user can add to themselves.}}


== AddGroups ==
== ==
{{see global|GroupsRemoveFromSelf|desc=Groups a user can remove from themselves.}}


== RemoveGroups ==
== ==
{{see global|AddGroups|desc=Groups a user can add to users.}}


== AvailableRights ==
== ==
{{see global|RemoveGroups|desc=Groups a user can remove from users.}}


== ContentHandlers ==
== ==
{{see global|AvailableRights|desc=User rights added by the extension.}}


== RateLimits ==
== ==
{{see global|ContentHandlers|desc=Mapping of Model ID to class name.}}


== RecentChangesFlags ==
== ==
{{see global|RateLimits|desc=Rate limis.}}


== MediaHandlers ==
== ==
Flags (letter symbols) down on RecentChanges pages.


== ExtensionFunctions ==
== ==
{{see global|MediaHandlers|desc=Plugins for media file type handling. Each entry in the array map maps a MIME type to a PHP class name.}}


=== ExtensionFunctions ===
== ExtensionMessagesFiles ==
{{see global|ExtensionFunctions|desc=Function to call after setup has finished.}}


=== ExtensionMessagesFiles ===
== MessageDirs ==
{{see global|ExtensionMessagesFiles|desc=File paths containing PHP internationalization files.}}


=== MessageDirs ===
== ExtensionEntryPointListFiles ==
{{see global|MessagesDirs|desc=Directory paths containing JSON internationalization data.}}


=== ExtensionEntryPointListFiles ===
== SpecialPages ==
An object.


== AutoloadClasses ==
== ==
{{see global|SpecialPages|desc=SpecialPages implemented in this extension (mapping of page name to class name).}}


== Hooks ==
== ==
{{see global|AutoloadClasses|desc=An object.}}


== JobClasses ==
== ==
{{see global|Hooks|desc=Hooks this extension uses (mapping of hook name to callback).}}


== LogTypes ==
== ==
{{see global|JobClasses|desc=Job types this extension implements (mapping of job types to class name).}}


== LogRestrictions ==
== ==
{{see global|LogTypes|desc=List of new log types this extension uses.}}


== FilterLogTypes ==
== ==
{{see global|LogRestrictions|desc=An object.}}


== ActionFilteredLogs ==
== ==
{{see global|FilterLogTypes|desc=An object.}}


== LogNames ==
== ==
{{see global|ActionFilteredLogs|desc=List of log types which can be filtered by log actions.}}


== LogHeaders ==
== ==
{{see global|LogNames|desc=An object.}}


== LogActions ==
== ==
{{see global|LogHeaders|desc=An object.}}


== LogActionsHandlers ==
== ==
{{see global|LogActions|desc=An object.}}


== Actions ==
== ==
{{see global|LogActionsHandlers|desc=An object.}}


== APIModules ==
== ==
{{see global|Actions|desc=An object.}}


== APIFormatModules ==
== ==
{{see global|APIModules|desc=An object.}}


== APIMetaModules ==
== ==
{{see global|APIFormatModules|desc=An object.}}


== APIPropModules ==
== ==
{{see global|APIMetaModules|desc=An object.}}


== APIListModules ==
== ==
{{see global|APIPropModules|desc=An object.}}


== ValidSkinNames ==
== ==
{{see global|APIListModules|desc=An object.}}


== FeedClasses ==
== ==
{{see global|ValidSkinNames|desc=An object.}}


== SkinOOUIThemes ==
== ==
{{see global|FeedClasses|desc=Available feed objects.}}


== PasswordPolicy ==
== ==
An object.


== FileExtensions ==
== ==
{{see global|PasswordPolicy|desc=Password policies.}}

=== FileExtensions ===
{{see global|FileExtensions|desc=Preferred file extensions for uploading.}}

=== callback ===
A function to be called right after MediaWiki processes this file.

=== config ===
{{TNT|MW version|version=1.25|comment=and after}}

The config section is where you can define configuration settings that sysadmins can change to configure the extension. This section should only be used for things that are configured in LocalSettings.php - if it is supposed to be modified by other extensions, you should use [[Manual:Extension registration#Attributes|attributes]], or if it is just class metadata, use a private static variable or something like that. The format of config changed in manifest_version 2, this documentation covers its usage in manifest_version 1.

A simple example:<syntaxhighlight lang="json">
{
"config": {
"FooBarUseExtraFeature": false
}
}
</syntaxhighlight>This is equivalent to writing <code>$wgFooBarUseExtraFeature = false;</code> in PHP. Note that the typical [[Manual:Wg variable|"wg" prefix]] is not included, as that will be added by default. If your settings start with a different prefix like <code>$eg</code>, you can use the magic <code>_prefix</code> key:<syntaxhighlight lang="json">
{
"config": {
"_prefix": "eg",
"FooBarUseExtraFeature": false
}
}
</syntaxhighlight>This is now equivalent to writing <code>$egFooBarUseExtraFeature = false;</code> in PHP.

A more complex example:<syntaxhighlight lang="json">
{
"config": {
"FooBarEnabledNamespaces": {
"0": true,
"2": true,
"4": true,
"_merge_strategy": "array_plus"
},
"FooBarCoolStuff": {
"sysop": {
"foo": true,
"bar": false
},
"_merge_strategy": "array_plus_2d"
}
}
}
</syntaxhighlight>The first setting, <code>$wgFooBarEnabledNamespaces</code>, has keys that are numbers, so PHP will turn them into integers, even though they are strings in JSON. Because of how PHP treats integer keys when merging arrays, we need to use a different type of merge here, so we set a different "merge strategy" using the magic key. In the second example, we have a nested array, which requires a different type of merging, since we want to allow people to continue writing <code>$wgFooBarCoolStuff['user']['foo'] = true;</code> in their LocalSettings.php.

==== Merge strategies ====
The following merge strategies are available:
* <code>array_merge</code>: Default, does not need to be explicitly set. Any keys that are integers will be re-numbered when merging.
* <code>array_plus</code>: Handles keys with integers properly.
* <code>array_plus_2d</code>: Handles nested arrays to a depth of 2 properly (e.g. <code>[[$wgGroupPermissions]]</code>).
* <code>array_plus_recursive</code>: Handles arrays even deeper than 2, though realistically, a configuration setting that is nested more than 2 arrays suggests too many things are being configured in one setting, and splitting it into multiple might be a good idea.
* <code>array_replace_recursive</code>: TODO why should this be used?


== callback ==
== ==
Prefix to put in front of configuration settings when exporting them to $GLOBALS.


== config_prefix ==
== ==
{{see global|ParserTestFiles|desc=Parser test suite files to be run by parserTests.php when no specific filename is passed to it.}}


== ParserTestFiles ==
== ==
List of service wiring files to be loaded by the default instance of MediaWikiServices.


=== load_composer_autoloader ===
== ServiceWiringFiles ==
Load the composer autoloader for this extension, if one is present.


== See Also ==
== load_composer_autoloader ==
* [https://github.com/wikimedia/mediawiki/blob/e3f89572a19400de0f18e714cb9ca8aaa0c0cfaa/docs/extension.schema.v1.json extension.schema.v1.json]
* [https://github.com/wikimedia/mediawiki/blob/e3f89572a19400de0f18e714cb9ca8aaa0c0cfaa/docs/extension.schema.v2.json extension.schema.v2.json]

Revision as of 23:03, 12 January 2017

This page documents the schema used by extension.json. All fields are optional unless otherwise specified. It is currently incomplete.

Schema

manifest_version

MediaWiki version:
1.25

This field is required.

This specifies the version of the extension.json file format that is being used. In the future if breaking changes are made to the file format, this number will be incremented to continue supporting extensions using the older format.

  • 1: 1.25+
  • 2: 1.29+
{
    "manifest_version": 1
}

Note: This field is typically placed at the bottom of extension.json files.

name

MediaWiki version:
1.25

This field is required.

This is the extension's canonical name. It should not be changed once set, as it is used as an API for other extensions to detect what is installed.

{
    "name": "FooBar"
}

namemsg

MediaWiki version:
1.25

A localized version of the extension's name. Typically the message key is named in the format <name>-extensionname or <name>-skinname.

{
    "namemsg": "foobar-extensionname"
}

type

MediaWiki version:
1.25

The type of extension it is, for sorting on Special:Version. The following types are supported:

Note: custom types can be added by using the ExtensionTypes hook. If not set, the extension will default to the "other" section.

{
    "type": "specialpage"
}

author

MediaWiki version:
1.25

The authors of the extension, may contain wikitext. This can either be a single string, or a list of strings. Additionally, the special string ... may be used to add a generic "and others" suffix using the version-poweredby-others message.

version

MediaWiki version:
1.25

The current version of the extension. Should be in a format supported by composer.

url

MediaWiki version:
1.25

URL to the extension's "homepage" or documentation. Typically points to https://www.mediawiki.org/wiki/Extension:<extensionname>.

description

MediaWiki version:
1.25

Description of the extension, may contain wikitext. Note: it is recommended to use descriptionmsg instead.

descriptionmsg

MediaWiki version:
1.25

Localization message key for the extension's description, typically in the format <extensionname>-desc. This will override description.

license-name

MediaWiki version:
1.25

The SPDX license identifier for the license the source code is licensed as. If you create a file named "COPYING" in the extension root directory with the contents of the license, it will also be linked and visible from Special:Version.

requires

MediaWiki version:
1.29

The requires section allows you to document dependencies on versions of MediaWiki core and other extensions.

{
    "requires": {
        "MediaWiki": ">= 1.27.0",
        "extensions": {
            "FooBar": "*",
            "Baz": ">= 1.2.3"
        }
    }
}

You can use any version specifier that composer supports. For MediaWiki, it is best practice to specify a >= for the minimum supported version, unless you know a future version is explicitly broken. For extensions, if they don't have a version specifier set, or don't use a versioning system, use a plain * to indicate any version is acceptable.

ResourceFileModulePaths

Specifies the default paths to use for all ResourceLoader file modules.

The allowed properties are:

  • localBasePath
  • remoteExtPath
  • remoteSkinPath

These correspond to the same options in each module definition in ResourceModules. If a value is not specified in the module definition, the default value specified here will be used.

{
    "ResourceFileModulePaths": {
        "localBasePath": "resources",
        "remoteExtPath": "FooBar/resources"
    }
}

ResourceModules

ResourceLoader modules to register.

This option corresponds directly with the global variable $wgResourceModules . Please refer to the documentation there on how to configure it.


ResourceModuleSkinStyles

ResourceLoader modules for custom skin styles.

This option corresponds directly with the global variable $wgResourceModuleSkinStyles . Please refer to the documentation there on how to configure it.


ResourceLoaderSources

ResourceLoader sources to register.

This option corresponds directly with the global variable $wgResourceLoaderSources . Please refer to the documentation there on how to configure it.


ResourceLoaderLESSVars

ResourceLoader LESS variables.

ConfigRegistry

Registry of factory functions to create Config objects.

This option corresponds directly with the global variable $wgConfigRegistry . Please refer to the documentation there on how to configure it.


SessionProviders

Session providers

This option corresponds directly with the global variable $wgSessionProviders . Please refer to the documentation there on how to configure it.


AuthManagerAutoConfig

AuthManager auto-configuration.

This option corresponds directly with the global variable $wgAuthManagerAutoConfig . Please refer to the documentation there on how to configure it.


The following properties are available:

  • preauth: Pre-authentication providers.
  • primaryauth: Primary authentication providers.
  • secondaryauth: Secondary authentication providers.

CentralIdLookupProviders

Central ID lookup providers.

This option corresponds directly with the global variable $wgCentralIdLookupProviders . Please refer to the documentation there on how to configure it.


ChangeCredentialsBlacklist

AuthenticationRequest classes which can only be used internally for credential change.

This option corresponds directly with the global variable $wgChangeCredentialsBlacklist . Please refer to the documentation there on how to configure it.


RemoveCredentialsBlacklist

AuthenticationRequest classes which can only be used internally for credential removal.

This option corresponds directly with the global variable $wgRemoveCredentialsBlacklist . Please refer to the documentation there on how to configure it.


namespaces

Method to add extra namespaces.

The following properties are available:

  • id: An integer.
  • constant: A string.
  • name: A string.
  • gender: Gender object. Properties are either "male" or "female."
  • subpages: Boolean. Default is false.
  • content: Boolean. Default is false.
  • defaultcontentmodel: A string.
  • protection: Userright(s) required to edit in this namespace. An array or string.
  • capitallinkoverride: Set $wgCapitalLinks on a per-namespace basis. Boolean.
  • conditional: Whether the namespace is conditional upon configuration and should not be registered (requires separate registration via a hook). Boolean. Default is false.

TrackingCategories

Tracking category message keys.

This option corresponds directly with the global variable $wgTrackingCategories . Please refer to the documentation there on how to configure it.


DefaultUserOption

This option corresponds directly with the global variable $wgDefaultUserOption . Please refer to the documentation there on how to configure it.


HiddenPrefs

Preferences users cannot set.

This option corresponds directly with the global variable $wgHiddenPrefs . Please refer to the documentation there on how to configure it.


GroupPermissions

Default permissions to give to user groups.

This option corresponds directly with the global variable $wgGroupPermissions . Please refer to the documentation there on how to configure it.


RevokePermissions

Default permissions to revoke from user groups.

This option corresponds directly with the global variable $wgRevokePermissions . Please refer to the documentation there on how to configure it.


GrantPermissions

Map of permissions granted to authorized consumers to their bundles, called 'grants.'

This option corresponds directly with the global variable $wgGrantPermissions . Please refer to the documentation there on how to configure it.


GrantPermissionGroups

Map of grants to their UI grouping.

This option corresponds directly with the global variable $wgGrantPermissionGroups . Please refer to the documentation there on how to configure it.


ImplicitGroups

Implicit groups.

This option corresponds directly with the global variable $wgImplicitGroups . Please refer to the documentation there on how to configure it.


GroupsAddToSelf

Groups a user can add to themselves.

This option corresponds directly with the global variable $wgGroupsAddToSelf . Please refer to the documentation there on how to configure it.


GroupsRemoveFromSelf

Groups a user can remove from themselves.

This option corresponds directly with the global variable $wgGroupsRemoveFromSelf . Please refer to the documentation there on how to configure it.


AddGroups

Groups a user can add to users.

This option corresponds directly with the global variable $wgAddGroups . Please refer to the documentation there on how to configure it.


RemoveGroups

Groups a user can remove from users.

This option corresponds directly with the global variable $wgRemoveGroups . Please refer to the documentation there on how to configure it.


AvailableRights

User rights added by the extension.

This option corresponds directly with the global variable $wgAvailableRights . Please refer to the documentation there on how to configure it.


ContentHandlers

Mapping of Model ID to class name.

This option corresponds directly with the global variable $wgContentHandlers . Please refer to the documentation there on how to configure it.


RateLimits

Rate limis.

This option corresponds directly with the global variable $wgRateLimits . Please refer to the documentation there on how to configure it.


RecentChangesFlags

Flags (letter symbols) down on RecentChanges pages.

MediaHandlers

Plugins for media file type handling. Each entry in the array map maps a MIME type to a PHP class name.

This option corresponds directly with the global variable $wgMediaHandlers . Please refer to the documentation there on how to configure it.


ExtensionFunctions

Function to call after setup has finished.

This option corresponds directly with the global variable $wgExtensionFunctions . Please refer to the documentation there on how to configure it.


ExtensionMessagesFiles

File paths containing PHP internationalization files.

This option corresponds directly with the global variable $wgExtensionMessagesFiles . Please refer to the documentation there on how to configure it.


MessageDirs

Directory paths containing JSON internationalization data.

This option corresponds directly with the global variable $wgMessagesDirs . Please refer to the documentation there on how to configure it.


ExtensionEntryPointListFiles

An object.

SpecialPages

SpecialPages implemented in this extension (mapping of page name to class name).

This option corresponds directly with the global variable $wgSpecialPages . Please refer to the documentation there on how to configure it.


AutoloadClasses

An object.

This option corresponds directly with the global variable $wgAutoloadClasses . Please refer to the documentation there on how to configure it.


Hooks

Hooks this extension uses (mapping of hook name to callback).

This option corresponds directly with the global variable $wgHooks . Please refer to the documentation there on how to configure it.


JobClasses

Job types this extension implements (mapping of job types to class name).

This option corresponds directly with the global variable $wgJobClasses . Please refer to the documentation there on how to configure it.


LogTypes

List of new log types this extension uses.

This option corresponds directly with the global variable $wgLogTypes . Please refer to the documentation there on how to configure it.


LogRestrictions

An object.

This option corresponds directly with the global variable $wgLogRestrictions . Please refer to the documentation there on how to configure it.


FilterLogTypes

An object.

This option corresponds directly with the global variable $wgFilterLogTypes . Please refer to the documentation there on how to configure it.


ActionFilteredLogs

List of log types which can be filtered by log actions.

This option corresponds directly with the global variable $wgActionFilteredLogs . Please refer to the documentation there on how to configure it.


LogNames

An object.

This option corresponds directly with the global variable $wgLogNames . Please refer to the documentation there on how to configure it.


LogHeaders

An object.

This option corresponds directly with the global variable $wgLogHeaders . Please refer to the documentation there on how to configure it.


LogActions

An object.

This option corresponds directly with the global variable $wgLogActions . Please refer to the documentation there on how to configure it.


LogActionsHandlers

An object.

This option corresponds directly with the global variable $wgLogActionsHandlers . Please refer to the documentation there on how to configure it.


Actions

An object.

This option corresponds directly with the global variable $wgActions . Please refer to the documentation there on how to configure it.


APIModules

An object.

This option corresponds directly with the global variable $wgAPIModules . Please refer to the documentation there on how to configure it.


APIFormatModules

An object.

This option corresponds directly with the global variable $wgAPIFormatModules . Please refer to the documentation there on how to configure it.


APIMetaModules

An object.

This option corresponds directly with the global variable $wgAPIMetaModules . Please refer to the documentation there on how to configure it.


APIPropModules

An object.

This option corresponds directly with the global variable $wgAPIPropModules . Please refer to the documentation there on how to configure it.


APIListModules

An object.

This option corresponds directly with the global variable $wgAPIListModules . Please refer to the documentation there on how to configure it.


ValidSkinNames

An object.

This option corresponds directly with the global variable $wgValidSkinNames . Please refer to the documentation there on how to configure it.


FeedClasses

Available feed objects.

This option corresponds directly with the global variable $wgFeedClasses . Please refer to the documentation there on how to configure it.


SkinOOUIThemes

An object.

PasswordPolicy

Password policies.

This option corresponds directly with the global variable $wgPasswordPolicy . Please refer to the documentation there on how to configure it.


FileExtensions

Preferred file extensions for uploading.

This option corresponds directly with the global variable $wgFileExtensions . Please refer to the documentation there on how to configure it.


callback

A function to be called right after MediaWiki processes this file.

config

MediaWiki version:
1.25

The config section is where you can define configuration settings that sysadmins can change to configure the extension. This section should only be used for things that are configured in LocalSettings.php - if it is supposed to be modified by other extensions, you should use attributes, or if it is just class metadata, use a private static variable or something like that. The format of config changed in manifest_version 2, this documentation covers its usage in manifest_version 1.

A simple example:

{
    "config": {
        "FooBarUseExtraFeature": false
    }
}

This is equivalent to writing $wgFooBarUseExtraFeature = false; in PHP. Note that the typical "wg" prefix is not included, as that will be added by default. If your settings start with a different prefix like $eg, you can use the magic _prefix key:

{
    "config": {
        "_prefix": "eg",
        "FooBarUseExtraFeature": false
    }
}

This is now equivalent to writing $egFooBarUseExtraFeature = false; in PHP. A more complex example:

{
    "config": {
        "FooBarEnabledNamespaces": {
            "0": true,
            "2": true,
            "4": true,
            "_merge_strategy": "array_plus"
        },
        "FooBarCoolStuff": {
            "sysop": {
                "foo": true,
                "bar": false
            },
            "_merge_strategy": "array_plus_2d"
        }
    }
}

The first setting, $wgFooBarEnabledNamespaces, has keys that are numbers, so PHP will turn them into integers, even though they are strings in JSON. Because of how PHP treats integer keys when merging arrays, we need to use a different type of merge here, so we set a different "merge strategy" using the magic key. In the second example, we have a nested array, which requires a different type of merging, since we want to allow people to continue writing $wgFooBarCoolStuff['user']['foo'] = true; in their LocalSettings.php.

Merge strategies

The following merge strategies are available:

  • array_merge: Default, does not need to be explicitly set. Any keys that are integers will be re-numbered when merging.
  • array_plus: Handles keys with integers properly.
  • array_plus_2d: Handles nested arrays to a depth of 2 properly (e.g. $wgGroupPermissions).
  • array_plus_recursive: Handles arrays even deeper than 2, though realistically, a configuration setting that is nested more than 2 arrays suggests too many things are being configured in one setting, and splitting it into multiple might be a good idea.
  • array_replace_recursive: TODO why should this be used?

config_prefix

Prefix to put in front of configuration settings when exporting them to $GLOBALS.

ParserTestFiles

Parser test suite files to be run by parserTests.php when no specific filename is passed to it.

This option corresponds directly with the global variable $wgParserTestFiles . Please refer to the documentation there on how to configure it.


ServiceWiringFiles

List of service wiring files to be loaded by the default instance of MediaWikiServices.

load_composer_autoloader

Load the composer autoloader for this extension, if one is present.

See Also

  • [extension.schema.v2.json|This page documents the schema used by extension.json. All fields are optional unless otherwise specified. It is currently incomplete.

Schema

manifest_version

MediaWiki version:
1.25

This field is required.

This specifies the version of the extension.json file format that is being used. In the future if breaking changes are made to the file format, this number will be incremented to continue supporting extensions using the older format.

  • 1: 1.25+
  • 2: 1.29+
{
    "manifest_version": 1
}

Note: This field is typically placed at the bottom of extension.json files.

name

MediaWiki version:
1.25

This field is required.

This is the extension's canonical name. It should not be changed once set, as it is used as an API for other extensions to detect what is installed.

{
    "name": "FooBar"
}

namemsg

MediaWiki version:
1.25

A localized version of the extension's name. Typically the message key is named in the format <name>-extensionname or <name>-skinname.

{
    "namemsg": "foobar-extensionname"
}

type

MediaWiki version:
1.25

The type of extension it is, for sorting on Special:Version. The following types are supported:

Note: custom types can be added by using the ExtensionTypes hook. If not set, the extension will default to the "other" section.

{
    "type": "specialpage"
}

author

MediaWiki version:
1.25

The authors of the extension, may contain wikitext. This can either be a single string, or a list of strings. Additionally, the special string ... may be used to add a generic "and others" suffix using the version-poweredby-others message.

version

MediaWiki version:
1.25

The current version of the extension. Should be in a format supported by composer.

url

MediaWiki version:
1.25

URL to the extension's "homepage" or documentation. Typically points to https://www.mediawiki.org/wiki/Extension:<extensionname>.

description

MediaWiki version:
1.25

Description of the extension, may contain wikitext. Note: it is recommended to use descriptionmsg instead.

descriptionmsg

MediaWiki version:
1.25

Localization message key for the extension's description, typically in the format <extensionname>-desc. This will override description.

license-name

MediaWiki version:
1.25

The SPDX license identifier for the license the source code is licensed as. If you create a file named "COPYING" in the extension root directory with the contents of the license, it will also be linked and visible from Special:Version.

requires

MediaWiki version:
1.29

The requires section allows you to document dependencies on versions of MediaWiki core and other extensions.

{
    "requires": {
        "MediaWiki": ">= 1.27.0",
        "extensions": {
            "FooBar": "*",
            "Baz": ">= 1.2.3"
        }
    }
}

You can use any version specifier that composer supports. For MediaWiki, it is best practice to specify a >= for the minimum supported version, unless you know a future version is explicitly broken. For extensions, if they don't have a version specifier set, or don't use a versioning system, use a plain * to indicate any version is acceptable.

ResourceFileModulePaths

Specifies the default paths to use for all ResourceLoader file modules.

The allowed properties are:

  • localBasePath
  • remoteExtPath
  • remoteSkinPath

These correspond to the same options in each module definition in ResourceModules. If a value is not specified in the module definition, the default value specified here will be used.

{
    "ResourceFileModulePaths": {
        "localBasePath": "resources",
        "remoteExtPath": "FooBar/resources"
    }
}

ResourceModules

ResourceLoader modules to register.

This option corresponds directly with the global variable $wgResourceModules . Please refer to the documentation there on how to configure it.


ResourceModuleSkinStyles

ResourceLoader modules for custom skin styles.

This option corresponds directly with the global variable $wgResourceModuleSkinStyles . Please refer to the documentation there on how to configure it.


ResourceLoaderSources

ResourceLoader sources to register.

This option corresponds directly with the global variable $wgResourceLoaderSources . Please refer to the documentation there on how to configure it.


ResourceLoaderLESSVars

ResourceLoader LESS variables.

ConfigRegistry

Registry of factory functions to create Config objects.

This option corresponds directly with the global variable $wgConfigRegistry . Please refer to the documentation there on how to configure it.


SessionProviders

Session providers

This option corresponds directly with the global variable $wgSessionProviders . Please refer to the documentation there on how to configure it.


AuthManagerAutoConfig

AuthManager auto-configuration.

This option corresponds directly with the global variable $wgAuthManagerAutoConfig . Please refer to the documentation there on how to configure it.


The following properties are available:

  • preauth: Pre-authentication providers.
  • primaryauth: Primary authentication providers.
  • secondaryauth: Secondary authentication providers.

CentralIdLookupProviders

Central ID lookup providers.

This option corresponds directly with the global variable $wgCentralIdLookupProviders . Please refer to the documentation there on how to configure it.


ChangeCredentialsBlacklist

AuthenticationRequest classes which can only be used internally for credential change.

This option corresponds directly with the global variable $wgChangeCredentialsBlacklist . Please refer to the documentation there on how to configure it.


RemoveCredentialsBlacklist

AuthenticationRequest classes which can only be used internally for credential removal.

This option corresponds directly with the global variable $wgRemoveCredentialsBlacklist . Please refer to the documentation there on how to configure it.


namespaces

Method to add extra namespaces.

The following properties are available:

  • id: An integer.
  • constant: A string.
  • name: A string.
  • gender: Gender object. Properties are either "male" or "female."
  • subpages: Boolean. Default is false.
  • content: Boolean. Default is false.
  • defaultcontentmodel: A string.
  • protection: Userright(s) required to edit in this namespace. An array or string.
  • capitallinkoverride: Set $wgCapitalLinks on a per-namespace basis. Boolean.
  • conditional: Whether the namespace is conditional upon configuration and should not be registered (requires separate registration via a hook). Boolean. Default is false.

TrackingCategories

Tracking category message keys.

This option corresponds directly with the global variable $wgTrackingCategories . Please refer to the documentation there on how to configure it.


DefaultUserOption

This option corresponds directly with the global variable $wgDefaultUserOption . Please refer to the documentation there on how to configure it.


HiddenPrefs

Preferences users cannot set.

This option corresponds directly with the global variable $wgHiddenPrefs . Please refer to the documentation there on how to configure it.


GroupPermissions

Default permissions to give to user groups.

This option corresponds directly with the global variable $wgGroupPermissions . Please refer to the documentation there on how to configure it.


RevokePermissions

Default permissions to revoke from user groups.

This option corresponds directly with the global variable $wgRevokePermissions . Please refer to the documentation there on how to configure it.


GrantPermissions

Map of permissions granted to authorized consumers to their bundles, called 'grants.'

This option corresponds directly with the global variable $wgGrantPermissions . Please refer to the documentation there on how to configure it.


GrantPermissionGroups

Map of grants to their UI grouping.

This option corresponds directly with the global variable $wgGrantPermissionGroups . Please refer to the documentation there on how to configure it.


ImplicitGroups

Implicit groups.

This option corresponds directly with the global variable $wgImplicitGroups . Please refer to the documentation there on how to configure it.


GroupsAddToSelf

Groups a user can add to themselves.

This option corresponds directly with the global variable $wgGroupsAddToSelf . Please refer to the documentation there on how to configure it.


GroupsRemoveFromSelf

Groups a user can remove from themselves.

This option corresponds directly with the global variable $wgGroupsRemoveFromSelf . Please refer to the documentation there on how to configure it.


AddGroups

Groups a user can add to users.

This option corresponds directly with the global variable $wgAddGroups . Please refer to the documentation there on how to configure it.


RemoveGroups

Groups a user can remove from users.

This option corresponds directly with the global variable $wgRemoveGroups . Please refer to the documentation there on how to configure it.


AvailableRights

User rights added by the extension.

This option corresponds directly with the global variable $wgAvailableRights . Please refer to the documentation there on how to configure it.


ContentHandlers

Mapping of Model ID to class name.

This option corresponds directly with the global variable $wgContentHandlers . Please refer to the documentation there on how to configure it.


RateLimits

Rate limis.

This option corresponds directly with the global variable $wgRateLimits . Please refer to the documentation there on how to configure it.


RecentChangesFlags

Flags (letter symbols) down on RecentChanges pages.

MediaHandlers

Plugins for media file type handling. Each entry in the array map maps a MIME type to a PHP class name.

This option corresponds directly with the global variable $wgMediaHandlers . Please refer to the documentation there on how to configure it.


ExtensionFunctions

Function to call after setup has finished.

This option corresponds directly with the global variable $wgExtensionFunctions . Please refer to the documentation there on how to configure it.


ExtensionMessagesFiles

File paths containing PHP internationalization files.

This option corresponds directly with the global variable $wgExtensionMessagesFiles . Please refer to the documentation there on how to configure it.


MessageDirs

Directory paths containing JSON internationalization data.

This option corresponds directly with the global variable $wgMessagesDirs . Please refer to the documentation there on how to configure it.


ExtensionEntryPointListFiles

An object.

SpecialPages

SpecialPages implemented in this extension (mapping of page name to class name).

This option corresponds directly with the global variable $wgSpecialPages . Please refer to the documentation there on how to configure it.


AutoloadClasses

An object.

This option corresponds directly with the global variable $wgAutoloadClasses . Please refer to the documentation there on how to configure it.


Hooks

Hooks this extension uses (mapping of hook name to callback).

This option corresponds directly with the global variable $wgHooks . Please refer to the documentation there on how to configure it.


JobClasses

Job types this extension implements (mapping of job types to class name).

This option corresponds directly with the global variable $wgJobClasses . Please refer to the documentation there on how to configure it.


LogTypes

List of new log types this extension uses.

This option corresponds directly with the global variable $wgLogTypes . Please refer to the documentation there on how to configure it.


LogRestrictions

An object.

This option corresponds directly with the global variable $wgLogRestrictions . Please refer to the documentation there on how to configure it.


FilterLogTypes

An object.

This option corresponds directly with the global variable $wgFilterLogTypes . Please refer to the documentation there on how to configure it.


ActionFilteredLogs

List of log types which can be filtered by log actions.

This option corresponds directly with the global variable $wgActionFilteredLogs . Please refer to the documentation there on how to configure it.


LogNames

An object.

This option corresponds directly with the global variable $wgLogNames . Please refer to the documentation there on how to configure it.


LogHeaders

An object.

This option corresponds directly with the global variable $wgLogHeaders . Please refer to the documentation there on how to configure it.


LogActions

An object.

This option corresponds directly with the global variable $wgLogActions . Please refer to the documentation there on how to configure it.


LogActionsHandlers

An object.

This option corresponds directly with the global variable $wgLogActionsHandlers . Please refer to the documentation there on how to configure it.


Actions

An object.

This option corresponds directly with the global variable $wgActions . Please refer to the documentation there on how to configure it.


APIModules

An object.

This option corresponds directly with the global variable $wgAPIModules . Please refer to the documentation there on how to configure it.


APIFormatModules

An object.

This option corresponds directly with the global variable $wgAPIFormatModules . Please refer to the documentation there on how to configure it.


APIMetaModules

An object.

This option corresponds directly with the global variable $wgAPIMetaModules . Please refer to the documentation there on how to configure it.


APIPropModules

An object.

This option corresponds directly with the global variable $wgAPIPropModules . Please refer to the documentation there on how to configure it.


APIListModules

An object.

This option corresponds directly with the global variable $wgAPIListModules . Please refer to the documentation there on how to configure it.


ValidSkinNames

An object.

This option corresponds directly with the global variable $wgValidSkinNames . Please refer to the documentation there on how to configure it.


FeedClasses

Available feed objects.

This option corresponds directly with the global variable $wgFeedClasses . Please refer to the documentation there on how to configure it.


SkinOOUIThemes

An object.

PasswordPolicy

Password policies.

This option corresponds directly with the global variable $wgPasswordPolicy . Please refer to the documentation there on how to configure it.


FileExtensions

Preferred file extensions for uploading.

This option corresponds directly with the global variable $wgFileExtensions . Please refer to the documentation there on how to configure it.


callback

A function to be called right after MediaWiki processes this file.

config

MediaWiki version:
1.25

The config section is where you can define configuration settings that sysadmins can change to configure the extension. This section should only be used for things that are configured in LocalSettings.php - if it is supposed to be modified by other extensions, you should use attributes, or if it is just class metadata, use a private static variable or something like that. The format of config changed in manifest_version 2, this documentation covers its usage in manifest_version 1.

A simple example:

{
    "config": {
        "FooBarUseExtraFeature": false
    }
}

This is equivalent to writing $wgFooBarUseExtraFeature = false; in PHP. Note that the typical "wg" prefix is not included, as that will be added by default. If your settings start with a different prefix like $eg, you can use the magic _prefix key:

{
    "config": {
        "_prefix": "eg",
        "FooBarUseExtraFeature": false
    }
}

This is now equivalent to writing $egFooBarUseExtraFeature = false; in PHP. A more complex example:

{
    "config": {
        "FooBarEnabledNamespaces": {
            "0": true,
            "2": true,
            "4": true,
            "_merge_strategy": "array_plus"
        },
        "FooBarCoolStuff": {
            "sysop": {
                "foo": true,
                "bar": false
            },
            "_merge_strategy": "array_plus_2d"
        }
    }
}

The first setting, $wgFooBarEnabledNamespaces, has keys that are numbers, so PHP will turn them into integers, even though they are strings in JSON. Because of how PHP treats integer keys when merging arrays, we need to use a different type of merge here, so we set a different "merge strategy" using the magic key. In the second example, we have a nested array, which requires a different type of merging, since we want to allow people to continue writing $wgFooBarCoolStuff['user']['foo'] = true; in their LocalSettings.php.

Merge strategies

The following merge strategies are available:

  • array_merge: Default, does not need to be explicitly set. Any keys that are integers will be re-numbered when merging.
  • array_plus: Handles keys with integers properly.
  • array_plus_2d: Handles nested arrays to a depth of 2 properly (e.g. $wgGroupPermissions).
  • array_plus_recursive: Handles arrays even deeper than 2, though realistically, a configuration setting that is nested more than 2 arrays suggests too many things are being configured in one setting, and splitting it into multiple might be a good idea.
  • array_replace_recursive: TODO why should this be used?

config_prefix

Prefix to put in front of configuration settings when exporting them to $GLOBALS.

ParserTestFiles

Parser test suite files to be run by parserTests.php when no specific filename is passed to it.

This option corresponds directly with the global variable $wgParserTestFiles . Please refer to the documentation there on how to configure it.


ServiceWiringFiles

List of service wiring files to be loaded by the default instance of MediaWikiServices.

load_composer_autoloader

Load the composer autoloader for this extension, if one is present.

See Also