aboutsummaryrefslogtreecommitdiffstats
path: root/includes/registration
Commit message (Collapse)AuthorAgeFilesLines
...
* registration: Only allow one extension to set a specific config settingFlorian Schmidt2017-08-221-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 Change-Id: Iaef32efab397e82ff70ddca8ac79c545c5b7d2bb
* build: Prepare for mediawiki/mediawiki-codesniffer to 0.9.0Umherirrender2017-06-262-2/+2
| | | | | | | | | | | | The used phpcs has a bug, so the version 0.9.0 could not be enforced at the moment. Will be fixed in next version, see T167168 Changed: - Remove duplicate newline at end of file - Add space between function and ( for closures - and -> &&, or -> || Change-Id: I4172fb08861729bccd55aecbd07e029e2638d311
* registration: Avoid deprecated wfMemcKey()Kunal Mehta2017-05-231-1/+1
| | | | Change-Id: I8f4382d55ba2d006f1573e945c83c3fd541a2cb1
* Merge "Allow namespaces defined in extension.json to be overwritten locally."jenkins-bot2017-05-211-2/+9
|\
| * Allow namespaces defined in extension.json to be overwritten locally.daniel2017-05-111-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | This allows extension namespaces to be assigned a custom ID, e.g. in case the namespace pre-defined by the extension is already taken on the local wiki. This is done by defining the respective namespace constant in LocalSettings.php. Bug: T160462 Change-Id: If648d6e218847e6632d643ea724cd3da3945db70
* | Merge "registration: Move attributes out of the top level"jenkins-bot2017-05-162-5/+72
|\ \
| * | registration: Move attributes out of the top levelKunal Mehta2017-05-152-5/+72
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves attributes out of the top level, and namespaces them under each extension. If the extension that it belongs to is not installed, the attribute is not exported and dropped. The full name of the attribute is the name of the extension plus the name of the attribute key. This enforces the recommendation that the attribute name start with the extension's name. Add test coverage for attributes under manifest_version 1 and 2. Bug: T133627 Depends-On: I5a148763f68989c8da313a4fb1d0213658ee4495 Depends-On: I5a148763f68989c8da313a4fb1d0213658ee4459 Change-Id: I8613a027c56e2c9d2c6a83ca14749eb1c8fc23be
* / registration: Deprecate not having manifest_version setKunal Mehta2017-05-151-2/+12
|/ | | | | | | | | | | | Emit a wfDeprecated() warning for each extension that does not have manifest_version set. Because we don't have any mechanism to cache warnings, just disable the cache if any deprecation warnings are emitted. This ensures that the warnings are shown on every page load instead of probably once a day. Bug: T155610 Change-Id: I163a84ae1d381ca5bd67b4b317c04f9f51c066ea
* Miscellaneous indentation tweaksBartosz Dziewoński2017-02-272-16/+16
| | | | | | | | | | I was bored. What? Don't look at me that way. I mostly targetted mixed tabs and spaces, but others were not spared. Note that some of the whitespace changes are inside HTML output, extended regexps or SQL snippets. Change-Id: Ie206cc946459f6befcfc2d520e35ad3ea3c0f1e0
* registration: Don't initialize MWServices super earlyKunal Mehta2017-01-101-17/+9
| | | | | | | | | | | | Previously, MediaWikiServices would be initialized on the first wfLoadExtension() call, which is super early and before it should be. There's actually no reason we need to create the BagOStuff object in the constructor, so let's defer it to loadFromQueue(). It now gets called from the top of Setup.php, which is still a little early, but better than before. Bug: T154960 Change-Id: I3feef3b974ba1ba3afec0d453e1899cd476e72fb
* registration: Always specify version number in extension.schema.json fileKunal Mehta2016-12-161-5/+1
| | | | | | | | | Instead of having the current version of the schema live at extension.schema.json, always include a version number in it. This simplifies both the code, and makes merging, cherry-picks, rebasing, etc. easier when the current schema version changes. Change-Id: I1b5ef4ced1eb34b8bdda7ba9b3f086b1997b704c
* registration: Improve dependency checkingKunal Mehta2016-12-152-39/+35
| | | | | | | | | | | * 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
* registration: Allow specifying extension dependenciesFlorian Schmidt2016-12-142-17/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* registration: Generalize CoreVersionChecker to VersionCheckerFlorian Schmidt2016-12-144-84/+139
| | | | | | | | This allows us to put other requirements more easily into extension registration, such as skins and/or extensions. Bug: T117277 Change-Id: I3ec1b28b6af380621585cd61b38e5ebb8be9f9c7
* Merge "registration: Provide credits information to callbacks"jenkins-bot2016-12-062-6/+11
|\
| * registration: Provide credits information to callbacksKunal Mehta2016-12-042-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Registration callbacks now provide basic credits information (name, path, type, authors, license-name, version, etc.) as the first argument. The main use case right now for this is to support extension VERSION constants for backwards-compatibility. In addition, callbacks now run *after* attributes are exposed, so callbacks could use data from them if they wanted to. Bug: T151136 Change-Id: Ic5965dd4e259e1f46222ac92b8e78750e67b51d6
* | Merge "registration: Refactor validation logic to avoid duplication"jenkins-bot2016-12-062-0/+144
|\|
| * registration: Refactor validation logic to avoid duplicationKunal Mehta2016-11-302-0/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, logic to validate extension.json files was in two places: validateRegistrationFile.php maintenance script, and the ExtensionJsonValidationTest.php structure test. This caused duplication as validation became more complex (e.g. usage of spdx-licenses library). A generic ExtensionJsonValidator class now handles most of the validation work, while the maintenance script and test case just wrap around it for their output formats. Change-Id: I47062a4ae19c58ee1b1f2bb4877913259bf19c8b
* | registration: Don't let extensions load lateFlorian Schmidt2016-12-041-0/+27
|/ | | | | | | | | | We want all extensions to be queued together and load at the same time so in the future we can properly evaluate dependencies as a whole. If extensions load late, they would bypass this, potentially causing issues. Bug: T117277 Change-Id: I09b306bd6f6ccf4210f36be0118e7f17f2c3d264
* registration: Set "FileExtensions" to $GLOBALSReedy2016-11-171-0/+1
| | | | Change-Id: Ie52004d25ebc06c81cd7d8d7de60479ff365ccea
* registration: Support setting $wgPasswordPolicy in extension.jsonReedy2016-11-171-0/+2
| | | | | Bug: T149597 Change-Id: I56c0b8932fcd42ec9b748529daa32a998fb19bf8
* Merge "Alphasort lists"jenkins-bot2016-11-091-42/+42
|\
| * Alphasort listsReedy2016-11-091-42/+42
| | | | | | | | Change-Id: Ibcc3541d5bd97eeda3b43a3f9acc2e90644b36b9
* | Check MW version requires before manifest_versionReedy2016-11-011-11/+15
|/ | | | | Bug: T149751 Change-Id: I914be4da431dcd613bdf2d1fd5ba9f28cf5b936b
* Added array_replace_recursive merge strategyYuri Astrakhan2016-10-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For extension registry, add array_replace_recursive merge strategy, as some extensions/configuration may prefer that to array_merge_recursive. In some cases, configuration is merged from multiple extensions, such as JsonConfig's $wgJsonConfigs configuration: ZeroBanner defines "JsonZeroConfig": { "namespace": 480, "nsName": "Zero", "isLocal": false, "cacheKey": "1" } and mobile.php overrides it with $wgJsonConfigs['JsonZeroConfig']['isLocal'] = false; $wgJsonConfigs['JsonZeroConfig']['remote'] = [ 'url' => 'https://zero.wikimedia.org/w/api.php', 'username' => $wmgZeroPortalApiUserName, 'password' => $wmgZeroPortalApiPassword, ]; Having identical value 'isLocal' would be converted into an array if array_merge_recursive is used, but the replace strategy fixes it. Change-Id: Ica6ddd0ae76f23e60de9b6235c6e2a3f2754a95d
* Merge "Fix ExtensionRegistry cache doc that is out of date"jenkins-bot2016-10-181-3/+2
|\
| * Fix ExtensionRegistry cache doc that is out of dateaddshore2016-10-181-3/+2
| | | | | | | | Change-Id: If019599baec4e8c566362744c2f565ca169b66b6
* | registration: Fix ignoring 'merge_strategy' key in manifest_version 2Yuri Astrakhan2016-10-181-1/+1
|/ | | | | Bug: T148493 Change-Id: Ibd88c4dc98f36d7d8336691884bbaa9a4864da83
* Clean up some ObjectCache factory callersAaron Schulz2016-10-031-1/+3
| | | | | | | | * Use services container in more places. * Undeprecated getLocalServerInstance() since $fallback is not handled elsewhere. Change-Id: Id1fcd1c465d2d92653357523f4225f1c4d1ace2f
* registration: Support 'ServiceWiringFiles' in extension.jsonKunal Mehta2016-08-251-0/+10
| | | | Change-Id: Ib413a14cb8e21207264fa1c45d84550b3eab7a4e
* registration: Support conditionally registered namespacesKunal Mehta2016-07-291-1/+4
| | | | | | | | | | | | | | | Some extensions (e.g. EventLogging) conditionally register a namespace depending upon the wiki's configuration using the CanonicalNamespaces hook. Since the "namespaces" key automatically registers the namespace, we need an option to not register it and let the extension take care of that manually using the hook. All of the other namespace related settings are safe to unconditionally set since they won't do anything if the namespace doesn't actually exist. Bug: T141604 Change-Id: Ie8c217fdc8bd783b30f98210309ea56fef39c0da
* registration: Support config setings that are relative pathsKunal Mehta2016-07-241-3/+7
| | | | | | | | | | | | | Add support for configuration settings that are relative paths to the extension directory. The most common use-case for this is where the extension ships a generic default file, but sysadmins or packagers may want to override it. Setting `"path": true` on the config definition will make the value be interpreted as a relative path. And add tests! Bug: T100956 Change-Id: Ia87ced25b35be7a314ee2937e0ccc63f9acc5bb5
* registration: Fix merge_strategy in manifest_version 2Kunal Mehta2016-07-241-1/+1
| | | | | | | merge_strategy is set in $data, which is the definition of the config setting, not the default value of it ($value). Change-Id: I12ee95892b2c157bb0beb97cf2cd5ef920b7d52e
* Merge "registration: Convert "config" into an object with metadata"jenkins-bot2016-07-142-4/+33
|\
| * registration: Convert "config" into an object with metadataKunal Mehta2016-07-132-4/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To add extra metadata for "config" options without constantly adding hacky underscore prefixed keys, convert "config" items into an object, where the value is under a "value" key. "_merge_strategy" is now just "merge_strategy", but still has the underscore prefix for the cache structure, to avoid changing it. Since this is a fully breaking change, it only applies to files with manifest_version: 2 set. A conversion script has been added to assist with automated conversion. Bug: T133626 Change-Id: Id1071fc0647892438e5cd0e3ee621fbdaaa64014
* | Merge "registration: Remove broken ResourceLoaderLESSImportPaths support"jenkins-bot2016-07-061-1/+0
|\|
| * registration: Remove broken ResourceLoaderLESSImportPaths supportKunal Mehta2016-07-021-1/+0
| | | | | | | | | | | | | | | | | | It never worked to begin with since it did not prefix paths, and the documentation for it says it should not be used by extensions, so let's stop pretending it works. Bug: T108271 Change-Id: I665d4439d14406038f2ac767ee5ec6eb5b67fca6
* | Merge "registration: Support Change/RemoveCredentialsBlacklist in ↵jenkins-bot2016-06-241-0/+2
|\ \ | |/ |/| | | extension.json"
| * registration: Support Change/RemoveCredentialsBlacklist in extension.jsonGergő Tisza2016-06-241-0/+2
| | | | | | Change-Id: I4d796a46d99daa8841fcdcbe76dddf9db46af9ed
* | registration: Add support for $wgGrantPermissions & $wgGrantPermissionGroupsKunal Mehta2016-06-201-0/+3
|/ | | | Change-Id: If336aa351ee5dc4dc07f63cfac2a5d236e501718
* Add AuthManagerBrad Jorsch2016-05-161-0/+2
| | | | | | | | | | | | | This implements the AuthManager class and its needed interfaces and subclasses, and integrates them into the backend portion of MediaWiki. Integration with frontend portions of MediaWiki (e.g. ApiLogin, Special:Login) is left for a followup. Bug: T91699 Bug: T71589 Bug: T111299 Co-Authored-By: Gergő Tisza <gtisza@wikimedia.org> Change-Id: If89d24838e326fe25fe867d02181eebcfbb0e196
* registration: Handle $wgSessionProviders in ExtensionProcessorGergő Tisza2016-05-121-0/+1
| | | | | See https://www.mediawiki.org/wiki/Manual:$wgSessionProviders Change-Id: Ic9daf9898a0c044d1e2611ca0276d7904a3372ce
* registration: Fix mode of files (755 -> 644)Florian2016-05-061-0/+0
| | | | | Follows up 7c4d73183cd9a2b38. Change-Id: I779534561ccb38b4c0f2ca5771dcb0aa810f930a
* registration: Allow string value for HooksFlorian2016-05-031-2/+6
| | | | | | | | | | | Instead of forcing an object even for single-hook-listeners, allow string values, too (one hook listener for one hook, only). Also: use it as default for the conversion script, if only one listener is added to a hook (which is usually the case). This leads into a much cleaner output of the Hooks section of extension.json. Bug: T133628 Change-Id: Ie9e54f0931c41706eb8d82d00256698992ec41cc
* registration: Allow ActionFilteredLogs to be modified by extensionsGlaisher2016-04-241-0/+1
| | | | | | Needed by Ibe628d9d08352 Change-Id: I7788fedc934b7c93facead796af30c89c335a513
* registration: Load extra autoload files before executing callbacksFlorian2016-04-061-4/+3
| | | | | | | | | Callbacks should be able to safely assume that anything (or at least mostly) defined in extension registration is already loaded and processed when the callback itself is executed. To make sure, that this applies, callbacks should be executed after all extra autoload paths are loaded. Bug: T131978 Change-Id: I2c6624423957a8a00523b126fa7209d9c283aa9e
* registration: Improve error message for non-array attributesKunal Mehta2016-03-121-4/+5
| | | | Change-Id: I7cbf7353ebbbbbbf36500f86164e3b32d7723cca
* registration: Avoid double slashes in localBasePathTimo Tijhof2016-02-181-2/+12
| | | | | | | | Noticed it in APC usage for ResourceLoader that various keys from FileContentsHasher contain double slashes. All from extensions that use the `"localBasePath": ""` trick in extension.json (e.g. Citoid). Change-Id: I5bac1e2e05e063aa7ff251ce7ffaa965a3451db9
* Remove comments about isset( $string['foo'] ) being true on PHP 5.3Bartosz Dziewoński2016-02-171-3/+1
| | | | | | ...but don't remove the code. Calling isset( $bar['foo'] ) without checking that $bar is an array seems not very nice to me. Change-Id: I822c925b6f36bf34902f8075e54f71fe4f6d2566
* Convert all array() syntax to []Kunal Mehta2016-02-172-36/+36
| | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b