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
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
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
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
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
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
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
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
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
This allows us to put other requirements more easily into extension
registration, such as skins and/or extensions.
Bug: T117277
Change-Id: I3ec1b28b6af380621585cd61b38e5ebb8be9f9c7
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
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
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
merge_strategy is set in $data, which is the definition of the config
setting, not the default value of it ($value).
Change-Id: I12ee95892b2c157bb0beb97cf2cd5ef920b7d52e
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
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
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
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
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
Normally the registry load queue should filter out duplicates, but if
people do weird things with symlinks, throw a useful error message if
the double-loading makes it all the way to the processor.
Bug: T121493
Change-Id: I47f5cd754e5f3c91e6b83a6d0ab542404347a421
Extensions that have composer dependencies can set
"load_composer_autoloader": true
to load "$dir/vendor/autoload.php" if it exists.
While it is recommended to use composer-merge-plugin to manage
composer dependencies for extensions, using a local autoloader
can be easier for development and is used by ExtensionDistributor.
Bug: T119766
Change-Id: Ib031bef17c8a7d708a5c7878e74967d19217bbc8
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
Allow extensions which are using "$eg" or any other prefix to migrate.
Extensions can override the default of "wg" by setting a magic "_prefix"
key in the "config" object.
Note that the migration helper script will not be able to automatically
migrate custom-prefixed configuration settings.
Bug: T97186
Change-Id: I79203cd5e3a2405b92ad01da869de3bd3d359d19
Using $wgExtraNamespaces overrides any localized namespaces with the
canonical form, which is not ideal.
Namespaces added through extension.json will now store the canonical
form and numerical id in a 'ExtensionNamespaces' attribute that is read
by MWNamespace::getCanonicalNamespaces().
Also fix the documentation on $wgExtraNamespaces, as using
$wgCanonicalNamespaceNames has not been possible since r85327.
Bug: T110389
Change-Id: I5bd9a7258f59d8c4a7ad0543d2115960fbea9b3a