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.

Posted in Uncategorized Tagged with: , , , , , ,
2 comments on “MediaWiki extensions to define their MediaWiki compatibility
  1. Theaitetos says:

    While this is a good idea and I appreciate it, I am not sure if I can make much use of it with extensions. As far as I know, there is currently no way to test extensions in different Mediawiki version settings. As a developer, you would have to remember every single line of code in your extension and be aware of every single change in Mediawiki versions, that might affect your extension, in order to know what the minimum or maximum version of Mediawiki is, that your extension can run on.

    So I don’t know what I should add as a version. If I am too conservative in my estimates, I unnecessarily prevent others from using my extension. If I am too broad in my assumptions, people might complain, that the extension doesn’t work despite me claiming that it should work with the used Mediawiki version.

1 Pings/Trackbacks for "MediaWiki extensions to define their MediaWiki compatibility"
  1. […] [Edit: it is now possible to list MediaWiki as a dependency and thus specify MediaWiki compatibility for your extension.] […]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">