Commit graph

13 commits

Author SHA1 Message Date
MGChecker
c7e45b6211 registration: Let extensions add PHP extension requirements
This change adds the possibility to specify ext-* keys under the 'platform'
key introduced in I6744cc0be2 to require given PHP extensions. Note that
it's impossible to add constraints different from '*', as there is no universal
way to retrieve PHP extension versions.

Bug: T197535
Change-Id: I510de1e6d80f5c1d92dc1d1665aaa6c25bf28bf7
2018-09-30 19:55:57 +02:00
MGChecker
8af76decf8 registration: Let extensions add PHP version requirements
While MediaWiki Core already sets requirements for PHP versions, it should be
possible for extensions to tighten these requirements. This mirrors the PHP
parameter of extension infoboxes as well.

This change introduces a new 'platform' key (in addition to 'MediaWiki', 'skins'
and 'extensions', where non-MediaWiki software requirements will be listed
in the future, starting with a PHP version constraint. Further keys are
supposed to be added to allow setting constraints against php extensions
and other abilities of the platform.

Bug: T197535
Change-Id: I6744cc0be2363b603331af9dc860eb8603a1a89a
2018-09-22 03:43:28 +02:00
Florian Schmidt
0f7e760334 registration: Use the correct key for skin dependencies
Instead of using "skin" to check for skin dependencies, extension registration
now uses the correct key "skins" (from the schema).

Bug: T197478
Change-Id: I382fc79229e1406786f444192e6e3e3bde44d224
2018-07-11 10:46:55 -07:00
jenkins-bot
cb20bab28c Merge "Handle extension dependencies in the installer" 2018-04-17 15:18:39 +00:00
Kunal Mehta
c8833d8e8e Handle extension dependencies in the installer
As there will likely be extensions bundled with the 1.31 release that
depend upon other extensions, we should have the installer prevent users
from enabling extensions that depend on other, not-enabled extensions.

We can build a dependency map from extension.json's "requires"
component. On the client-side, we'll first disable all checkboxes that
require other extensions, and evaluate each checkbox click, updating the
disabled checkboxes as possible.

This required some refactoring of how ExtensionRegistry reports issues
with dependency resolution so we could get a list of what was missing.

While we're at it, sort the extensions under headings by type.

This does not support skins that have dependencies yet (T186092).

Bug: T31134
Bug: T55985
Change-Id: I5f0e3b1b540b5ef6f9b8e3fc2bbaad1c65b4b680
2018-04-13 15:28:40 -07:00
Kunal Mehta
9294360e7d Use PHPUnit 4/6 compat in VersionCheckerTest
Change-Id: Idff5d83ce20262b159c00722301e519590e80d66
2018-04-12 09:49:54 -07:00
Umherirrender
63d96c15fd build: Updating mediawiki/mediawiki-codesniffer to 16.0.0
Change-Id: I59b59f79bbf3ce4feff3b3a20c1c31bc16370531
2018-02-17 13:29:13 +01:00
Kunal Mehta
4ca1b96184 Complete VersionChecker test coverage
And fix a few typos in the error messages and the accidental inclusion
of whitespace.

Change-Id: I4ea90c5543e394c3f30b1da1456e4676377188f7
2018-02-09 23:14:07 -08:00
Umherirrender
45da581551 Use ::class to resolve class names in tests
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: Ie541a7baae10ab6f5c13f95ac2ff6598b8f8950c
2018-01-26 22:49:13 +01:00
Kunal Mehta
75160bdd3b Use MediaWikiCoversValidator for tests that don't use MediaWikiTestCase
Change-Id: I8c4de7e9c72c9969088666007b54c6fd23f6cc13
2018-01-01 08:28:02 +00:00
Kunal Mehta
90cfe33631 registration: Improve dependency checking
* Pass $coreVersion to VersionChecker's constructor, don't require a
setter.
* Bump ExtensionRegistry::CACHE_VERSION
* Return single strings from handle* functions, avoid array_merge calls
* Improve invalid version error message
* Fix naming of VersionCheckerTest class

Change-Id: Id4f66b815aa41dbbc4b966095d6b99e542e548b4
2016-12-15 15:09:26 -08:00
Florian Schmidt
90698a878b 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
2016-12-14 19:18:09 +01:00
Florian Schmidt
5f11f7818c registration: Generalize CoreVersionChecker to VersionChecker
This allows us to put other requirements more easily into extension
registration, such as skins and/or extensions.

Bug: T117277
Change-Id: I3ec1b28b6af380621585cd61b38e5ebb8be9f9c7
2016-12-14 19:18:09 +01:00
Renamed from tests/phpunit/includes/registration/CoreVersionCheckerTest.php (Browse further)