registration: Allow specifying extension dependencies
authorFlorian Schmidt <florian.schmidt.stargatewissen@gmail.com>
Sat, 3 Dec 2016 18:19:25 +0000 (19:19 +0100)
committerFlorian Schmidt <florian.schmidt.stargatewissen@gmail.com>
Wed, 14 Dec 2016 18:18:09 +0000 (19:18 +0100)
commit90698a878b5b0dfdaffd06a0cb5ac6b1465bcbdb
tree623873776ccbfad48e0abcead5c0ce92da517e0f
parent5f11f7818c3e3f82245ce92aa699e08fa086b70a
registration: Allow specifying extension dependencies

There are some extensoins that depend upon another extension or skin,
usually in different ways:
* A constant that is added in the dependency extension, and the
existence of is checked for. This is problematic because it requires a
specific load order.
* Checking whether a specific class exists. This is problematic because
it is extremely fragile, and breaks whenever the class is renamed.
* Checking ExtensionRegistry::isLoaded(). This is mostly there, but it
only checks at runtime, and doesn't provide any machine readable data.

Furthermore, developers implement each one differently, with very little
standardization.

With this, extensions may now specify what other extensions they depend
on. This is for explicit *hard* dependencies that must be installed.

For example:
"requires": {
"MediaWiki": ">= 1.25.0",
"extensions": {
"FakeExtension": "*"
},
"skins": {
"FakeSkin": "*"
}
}

This would add a minimum requirement on MediaWiki 1.25.0+ (already
implemented), as well as the requirement that the FakeExtension extension
needs to be installed, as well as the FakeSkin skin. A wildcard (*) is
used instead of an explicit version requirement as many extensions do
not actually version themselves, and there is no consistent versioning
scheme yet.

Bug: T117277
Change-Id: If1cccee1a16a867a71bb0285691c400443d8a30a
docs/extension.schema.json
includes/registration/ExtensionRegistry.php
includes/registration/VersionChecker.php
tests/phpunit/includes/registration/VersionCheckerTest.php