Updated on March 17, 2014
MediaWiki extensions to define their MediaWiki compatibility
Over the past year support for real dependency management has been gradually added to MediaWiki and selected extensions. This support being based on the Composer software.
While extensions have been able to specify their dependencies for a while, such as PHP libraries and other extensions, they where not able to specify the MediaWiki versions they work with. The reason for this being that there is simply no MediaWiki package. Extensions are installed into MediaWiki, as opposed to people installing a MediaWiki package (and its dependencies) into something else. Changing this would resolve the issue, though I’m not sure this is a good idea. What I am however sure of is that such a change is not going to be made any time soon for mainly political reasons. I have now tackled the issue using an alternative approach that requires no change to existing workflows and can be happily ignored by people afraid from evil things such as third party software, namespaces and anonymous functions.
This alternative approach is based on adding a “provide” package link to the root package (this is the package into which extensions are installed). If this provide link points to a mediawiki package with specific version, then extensions can specify they need this version, and have this requirement satisfied on installation in the root package. Rather then having this link defined in composer.json, which would mean people would need to update the version there manually or an automatic composer.json-modifier would need to be created, the link is added programatically via a Composer hook.
Extensions will thus be able to specify their compatibility as follows (in their composer.json):
The commit adding this capability to MediaWiki is awaiting review on Gerrit. Many thanks go to @beausimensen for providing the basis of this idea and helping with implementation. Thanks also go to @seldaek for tweaking Composer so this approach would actually work.