registration: Allow extensions to specify which MW core versions they require
authorKunal Mehta <legoktm@gmail.com>
Thu, 14 May 2015 05:51:55 +0000 (22:51 -0700)
committerKunal Mehta <legoktm@gmail.com>
Mon, 21 Sep 2015 16:56:53 +0000 (09:56 -0700)
commitcef1f31167177ca05c8981d61d1203172329345d
tree7a18b809c7d0d544e52569401f004bc3fe039361
parentaed32e47cef570d7d89e0c765d5269ad20fb4b9a
registration: Allow extensions to specify which MW core versions they require

This adds a "requires" property to extension.json, which extensions and
skins can use to indicate which versions of MediaWiki core they support.
The hacky wfUseMW() is now deprecated in favor of this.

Rather than writing our own version constraint and parser library, we
can re-use composer's, which was recently split out into a separate
library named "composer/semver" for this patch.

Any syntax accepted by composer[1] is available for usage here. Test
cases have been provided to demonstrate how versions are parsed. For now
it is recommended that people stick to expressing compatability with
stable versions (e.g. ">= 1.26").

This patch does not support requiring specific MediaWiki core WMF
branches, since those do not follow the standard semver format that
composer parses. If we are unable to parse $wgVersion, all checking will
be skipped and reported as compatible.

[1] https://getcomposer.org/doc/01-basic-usage.md#package-versions

Bug: T99084
Change-Id: I7785827216e16c596356d0ae42d6b30f3f179f10
autoload.php
composer.json
docs/extension.schema.json
includes/GlobalFunctions.php
includes/registration/CoreVersionChecker.php [new file with mode: 0644]
includes/registration/ExtensionProcessor.php
includes/registration/ExtensionRegistry.php
includes/registration/Processor.php
tests/phpunit/includes/registration/CoreVersionCheckerTest.php [new file with mode: 0644]