aboutsummaryrefslogtreecommitdiffstats
path: root/includes/registration
Commit message (Collapse)AuthorAgeFilesLines
...
* registration: Allow to require environment abilitiesMGChecker2019-04-133-9/+96
| | | | | | | | | | | | | | | | | | | | | | This patch adds the possibility for extensions and skins to require certain environment abiltites that are not necessarily PHP extensions. For now, the only ability introduced is the ability to shell out, but the processing and testing is written in a more general way to allow users to add more abilties later on by just changing getAbilities(). In theory, this allows using VersionChecker to check for random abilities if they are specified in the constructor, as it is comletely environment agnostic and not really bound to just be used for checking extension compatibility. Furthermore, it is possible to specify custom error messages for each of these abilities in the constructor. Other parts of MediaWiki may use these features to check for requirements while working with totally different abilities. Bug: T212472 Change-Id: Iff8512530b08ef509e7ac0b6ed8fe9578ef3e2a1
* Merge "registration: Follow-up on I54e8065c63f81016425c7dd40ce87e"jenkins-bot2019-03-251-1/+0
|\
| * registration: Follow-up on I54e8065c63f81016425c7dd40ce87eDerick Alangi2019-03-251-1/+0
| | | | | | | | Change-Id: I610dfafcd180f89ee0e786f4516f9eb9c63a42b4
* | registration: Remove wrong `@return` PHPDoc commentsDerick Alangi2019-03-251-1/+0
|/ | | | | | | | | $this->attributes is an array class property that gets set by the method extractInfo(). This method really doesn't return an array though in a sense $this->attributes gets set which can be used but it's not returned. Change-Id: I54e8065c63f81016425c7dd40ce87e1eb8ba0830
* registration: Fix if or elseif constructs with return statementsDerick Alangi2019-03-221-12/+18
| | | | Change-Id: I7abd09d8959daddaa161bd92a1b1b23a4abbab32
* Convert a few call_user_func*() calls to native PHP syntaxMax Semenik2019-03-071-1/+1
| | | | Change-Id: I54d94f4369eb4fa0b0ebe892a1d6cc57b2bdb1f9
* resourceloader: Support TestModules registration via extension.jsonTimo Tijhof2019-02-051-1/+15
| | | | | Bug: T126091 Change-Id: I27ecebe27d7aaebe6d1317bc5eaea9cca368b45d
* registration: Add @codeCoverageIgnore for statement that can't be coveredKunal Mehta2019-01-181-0/+2
| | | | | | | MW_PHPUNIT_TEST will always be defined during tests, so we can't have a test that requires it to be undefined. Change-Id: I67b011af31026bc9c568725f8f294359b63f2fd5
* registration: Allow overriding attributes in testsKunal Mehta2019-01-141-1/+31
| | | | | | | | | | ExtensionRegistry is a rather special singleton that can't use the normal MediaWikiServices reset due to its early initialization, so introduce a ->setAttributeForTest method to override attributes that are typically loaded from extension.json. Bug: T200013 Change-Id: I9e62a02ed2044c847e9ab2dcdfab094001f88986
* Add $wgReauthenticateTime to extension.jsonGergő Tisza2018-11-151-0/+1
| | | | Change-Id: I9722c065d522e18b6bf488c721f48ee7b7b9e494
* Use PHP 7 '??' operator instead of if-then-elseFomafix2018-10-211-5/+1
| | | | Change-Id: If9d4be5d88c8927f63cbb84dfc8181baf62ea3eb
* registration: Let extensions add PHP extension requirementsMGChecker2018-09-303-4/+42
| | | | | | | | | | 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
* registration: Let extensions add PHP version requirementsMGChecker2018-09-223-16/+80
| | | | | | | | | | | | | | | 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
* registration: Use null coalescing operatorMGChecker2018-09-041-5/+1
| | | | Change-Id: Iba5df6fe8c647baaaff91df311efec22cca7e88f
* Merge "registration: Add ability to check if a specific extension version is ↵jenkins-bot2018-09-031-2/+18
|\ | | | | | | loaded"
| * registration: Add ability to check if a specific extension version is loadedMGChecker2018-09-031-2/+18
| | | | | | | | | | | | | | | | | | As it's quite common that extensions and skins interact with each other, it's useful to have a simple way to check if an extension version satisfies a given constraint, as extensions change over time. Bug: T202955 Change-Id: I19f9713caf89d647072a2bd7d598e739be383f4a
* | registration: Short-circuit if dependency constraint is '*'Kunal Mehta2018-08-281-15/+11
| | | | | | | | | | | | | | | | | | | | Most extensions depend upon any version of other extensions/skins since versioning is pretty inconsistent. Since '*' is so commonly used, explicitly short-circuit that constraint since we only need to check whether the dependency is loaded. Bug: T198044 Change-Id: I5526c8068d3b9a6ee5ca71ea6bdbcd693f1ffb7a
* | Require editsitecss/editsitejs for editing raw messagesGergő Tisza2018-08-261-0/+1
|/ | | | | Bug: T45646 Change-Id: Ib16db04e499ad28216ee08b8cccccf3f141e2bad
* resourceloader: Remove $wgResourceLoaderLESSVars supportTimo Tijhof2018-08-141-1/+0
| | | | | | | | | | | | | The use of global variables was deprecated in favour of ResourceLoaderModule::getLessVars() on a per-module basis. Also moved testLessFileCompilation case to the appropiate file as it covers ResourceLoaderFileModule.php, not ResourceLoader.php. Bug: T140804 Depends-On: Ib1b2808df2384473bfac47f53a5d25d7c9bbca2b Depends-On: I96047f69d01c4736306df2719267e6347daf556f Change-Id: If708087c85c80355c7e78f1768529b5f2e16ed07
* Merge "registration: Expose config array to ExtensionRegistry"jenkins-bot2018-07-193-1/+13
|\
| * registration: Expose config array to ExtensionRegistryFlorian Schmidt2018-07-193-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | Currently, the ExtensionProcessor processes the config array of the extension and just sets the value as a global. In this way, however, the metadata of the configs (description, public, ...) aren't available. This change exposes the configurations in the extracted data as the config key. Bug: T155908 Change-Id: Ie41e6ecb8d08a5b20b56eb2281af1dfdd808b2c4
* | registration: Add class docs for ExtensionJsonValidatorTimo Tijhof2018-07-181-0/+9
| | | | | | | | Change-Id: Ic37544de1400600719764057a63cc546c26218d8
* | Merge "registration: Validate no duplicate keys exist in extension.json"jenkins-bot2018-07-181-2/+14
|\ \
| * | registration: Validate no duplicate keys exist in extension.jsonFlorian Schmidt2018-07-181-2/+14
| |/ | | | | | | | | | | | | | | | | | | | | | | The JSON specification permits duplicate keys, but doing so is almost always nearly a mistake. We can use the JSON lint library (added as dev-requirement to composer), which is now also used to decode the JSON (as it's the same step as validating the JSON). Bug: T153507 Change-Id: Ia713a1906169333c1aa2aebdc0ed060d26428d72
* / registration: Use the correct key for skin dependenciesFlorian Schmidt2018-07-111-2/+2
|/ | | | | | | | 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
* registration: Catch correct exception type from ObjectCacheKunal Mehta2018-06-111-1/+1
| | | | | | | ObjectCache::newFromId() now throws an InvalidArgumentException if the specific id can't be found. Change-Id: Idcb0f2158a38555c1ec1681ba0635c7903e48718
* registration: Allow the mtime of extension.json files to be zeroEd Schouten2018-06-071-1/+1
| | | | | | | | | | | | | When creating Docker images of MediaWiki using the Bazel build system, I noticed that I'm not able to load any extensions. This is due to the fact that Bazel always generates container layers with mtimes of files set to 1970-01-01 for determinism/reproducibility. Relax the check a bit to only fail when the mtime is false, which happens when filemtime() fails. Bug: T196672 Change-Id: Ieaeb3113a7d9c44f29cca2d062c5bb11ebeada0d
* Merge "Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient"jenkins-bot2018-05-311-5/+3
|\
| * Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenientBartosz Dziewoński2018-05-301-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/ Replace with: '\1 ?? ' (Everywhere except includes/PHPVersionCheck.php) (Then, manually fix some line length and indentation issues) Then manually reviewed the replacements for cases where confusing operator precedence would result in incorrect results (fixing those in I478db046a1cc162c6767003ce45c9b56270f3372). Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
* | registration: Initialize PSR-4 namespaces at same stage as normal autoloaderAntoine Musso2018-05-301-0/+1
|/ | | | | | | | | | | | | | | readFromQueue() injects the content of AutoloadClasses to $wgAutoloadClasses however it missed doing the same for AutoloadNamespaces. When using the installer with an extension having AutoloadNamespaces set, its classes would not be found. Make ExtensionRegistry append to AutoLoader::$psr4Namespaces, and add a test to cover the new behavior. Bug: T195783 Change-Id: Id61155867a4ca7d9bc4a347f8671da74b0fa490b
* registration: Perform extra validation for mediawiki.org URLsKunal Mehta2018-05-191-5/+19
| | | | | | | | | If the "url" field in extension.json is pointing to mediawiki.org, perform some extra validation steps: * Require HTTPS * Require the `www.mediawiki.org` canonical domain Change-Id: I3371443d3f6c76f53437adf90a700969bba7d0e7
* registration: Improve duplicate config setting exceptionKunal Mehta2018-05-151-11/+15
| | | | | | | | | | | | | | We don't keep track of what set a specific global, so at least mention the name of the extension that is setting a duplicate for easier debugging. Also, fix the case where if the first extension to be loaded was setting a core setting, it would not throw an exception since config was being processed before the rest of extension.json. Now we process config after all core settings, going only before attributes. Bug: T194319 Change-Id: I4fd96e7d167cf0652ee3e8e66167c86f2b91b992
* Don't initialize MediaWikiServices before extensions have been loadedMax Semenik2018-05-031-3/+4
| | | | | | Bug: T153256 Bug: T190425 Change-Id: I749f66d13a8c8a8ae4a83661b83c56f0db74a187
* Handle extension dependencies in the installerKunal Mehta2018-04-133-13/+116
| | | | | | | | | | | | | | | | | | | | | | 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
* Improve ExtensionRegistry test coverageKunal Mehta2018-02-121-0/+3
| | | | Change-Id: I7f7445952f057995a3e3215145803affa5aceede
* registration: Remove unused ExtensionRegistry::markLoadedKunal Mehta2018-02-121-10/+0
| | | | | | | | This is unused, and it would make more sense for whatever wants to add credits to directly modify $this->loaded instead of incurring the overhead of an extra function call. Change-Id: Icce1a87d2dc8ce61cb05eace6e0b65d6cea4c58d
* Add tests for ExtensionJsonValidatorKunal Mehta2018-02-091-0/+1
| | | | Change-Id: I883a502fc3ed6cd7b8651d9e5e78dba7177ead9c
* Complete VersionChecker test coverageKunal Mehta2018-02-091-4/+4
| | | | | | | And fix a few typos in the error messages and the accidental inclusion of whitespace. Change-Id: I4ea90c5543e394c3f30b1da1456e4676377188f7
* registration: Simplify extracting path based globalsKunal Mehta2018-02-091-15/+17
| | | | | | | | The code for ParserTestFiles and ServiceWiringFiles was identical, so unify it into one function. For most extensions, this should save two unnecessary function calls as a bonus. Change-Id: If5ed189f97b7d3b9cd7b550f3ad2e90abe30005d
* convertExtensionToRegistration: Set requires key in extension.jsonUmherirrender2018-02-051-0/+7
| | | | | | | | | | | | The highest manifest version is not supported from the start of extension.json For extensions converted to this highest version the mininum core version must be specified to avoid load problems in the extension. Using 1.29.0 for manifest version 2 due to T149757 / Id1071fc0647892438e5cd0e3ee621fbdaaa64014 Change-Id: Iea5ba589c70958db7500cf3587b5ebd738532026
* ExtensionRegistry: Properly detect if a global is already setMarius Hoch2018-01-231-1/+1
| | | | | | | | | | | | | $foo = null; isset( $foo ); will yield false. Sometimes we want to explicitly set a config to null, but ExtensionRegistry is then overriding this variable with the default value. This is no consistent with the old workflow: require_once the extension and then override the setting with null. Bug: T128661 Change-Id: I0654c9369a596e84591fcaa9643703e6b4ccf57e
* Fix additional usage of incorrect casemainframe982017-12-151-1/+1
| | | | | | | | Courtesy of the PhpStorm inspection Case mismatch in method call or class usage. Bug: T166759 Change-Id: I27c53658b99048fa0dd8f9d6ef1398620386e1cc
* Avoid using array_map in ExtensionRegistry and ExtensionProcessor for simple ↵Yifei He2017-12-142-8/+10
| | | | | | | operations Bug: T182645 Change-Id: Ia98b1d798b1f93ca30686c009d479668616229ae
* Enable using PSR-4 autoloader for MediaWiki core and extensionsKunal Mehta2017-12-121-14/+21
| | | | | | | | | | | | | | | | | | | | | This adds support for a PSR-4 (<http://www.php-fig.org/psr/psr-4/>) autoloader, so instead of needing to manually list each class, just the namespace prefix is needed. Extensions can set a "AutoloadNamespaces" property in extension.json to register PSR-4 compatible namespaces to be autoloaded. The implementation is based off of the example implementation (<http://www.php-fig.org/psr/psr-4/examples/>) with some modifications for performance, notably cutting down on function calls, and only trying to look up classes that are namespaced. The generateLocalAutoload.php script will ignore any directory that is registered as a PSR-4 namespace. Bug: T99865 Bug: T173799 Change-Id: Id095dde37cbb40aa424fb628bd3c94e684ca2f65
* Merge "registration: Only allow one extension to set a specific config setting"jenkins-bot2017-10-241-2/+17
|\
| * registration: Only allow one extension to set a specific config settingFlorianschmidtwelzow2017-08-281-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ExtensionProcessor would previously just blindly overwrite duplicate config settings, which ends up depending upon load order. It's relatively hard to debug since it is silently overwritten. This now throws exceptions in case of duplicate config settings. This will also have some side-effects of catching people putting things like "ResourceModules" in their "config" section when it should be a top-level item. Bug: T152929 Depends-On: I4c5eaf87657f5dc07787480a2f1a56a1db8c714f Change-Id: Ieeb26011e42c741041d2c3252238ca0823b99eb4
* | registration: Fix caching of load_composer_autoloaderKunal Mehta2017-09-222-5/+4
| | | | | | | | | | | | | | | | | | | | Move the file_exists() check out of the extension processor and into the extension registry so that it is evaluated at run time instead of during caching. The prior way is problematic since we don't invalidate the cache if the existence of the file were to change. Bug: T176534 Change-Id: I98e4ffdfac9f98397a103966824519afe1375356
* | registration: Fix typo in validatorKunal Mehta2017-09-191-1/+1
| | | | | | | | Change-Id: Ic4f0eb5f05504922c20213e1d321fa14c979b6f8
* | registration: Improve error message for invalid "callback" in extension.jsonUmherirrender2017-09-091-0/+6
|/ | | | | | | | Getting the following error for an invalid callback is not helpful: Warning: Invalid argument: function: class not found in /includes/registration/ExtensionRegistry.php on line 335 Change-Id: I4dfc011cb0a5cd06f1836d73e58f407d468e4546
* Revert "registration: Only allow one extension to set a specific config setting"Thcipriani2017-08-221-17/+2
| | | | | | | | Breaks mergeMessageFileList which means scap can't run in beta. This reverts commit 50d7546057c1089228a2a6d7d4a49d78d72887e3. Change-Id: Idb65f1098abce28d49ebbcc8254c0976b6861c59