Making more MediaWiki extensions installable via Composer
To make MediaWiki extensions installable via Composer, the following steps must be followed:
- Modify the main extension file (e.g. ExtensionName.php) to change all $wgVariableName global variables to $GLOBALS['wgVariableName']
- Create a composer.json file with information pull from main extension file
- Submit patch to main repository (Gerrit or GitHub as required)
- Create corresponding Packagist.org package (e.g. mediawiki/extension-name)
To-do: Construct proper regex to convert variable naming
Composer.json file should look like the following, with proper values inserted based on main extension file.
{
"name": "mediawiki/<extension-name-with-hyphens>",
"type": "mediawiki-extension",
"description": "<try to pull from ExtensionName.php, else use dummy text>",
"keywords": [
"MediaWiki"
],
"homepage": "<attempt to pull from ExtensionName.php, else blank>",
"license": "<leave as ‘unknown’?>",
<for “authors”: $wgExtensionCredits variable, loop over the relevant “author” field>
"authors": [
{
"name": "Yaron Koren",
"role": "Author"
}
],
"support": {<leave blank if possible>},
"require": {
"composer/installers": ">=1.0.1"
},
"autoload": {
"files": ["<ExtensionName>.php"]
}
}
Should we automate this somehow? Is that desireable?
Should we automate this somehow? Is that desireable?