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
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
$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
When two keys have conflicting values, the value from extension.json wins
when using this merge strategy.
Change-Id: I0222682f3b3fb08f80afc7dda677da7bbfe8e5d1
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
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
We want the local configuration ($GLOBALS[$key]) to override the default
values ($val). This matches what `array_merge` does.
Bug: T112868
Change-Id: I9c333a1fa67d3f24e09ffed3072b2897389f6139
Instead of hardcoding specific global settings in ExtensionRegistry,
create specific "merge strategies" that are used to merge globals.
Merge strategies are set for core properties in the ExtensionProcessor,
and extensions can set them for their own configuration settings using
the magic "_merge_strategy" key.
The following merge strategies are included:
* array_merge_recursive - call `array_merge_recursive` on the two arrays
* array_plus - use the "+" operator to combine arrays, preserving
integer keys
* array_plus_2d - A version of array_plus that works on 2d arrays, used
for merging arrays like $wgGroupPermissions
* array_merge - call `array_merge` (default)
This changes the merging of various namespaces related settings to use
array_plus so they actually work.
Bug: T107646
Change-Id: I64cb0553864e3b78b0f203333f58bb73b86a6434
Our optimization of !$GLOBALS[$key] was affecting settings where a true
setting was being disabled in LocalSettings.php. Now explicitly check it
is an array before overriding it.
Bug: T100767
Change-Id: Id5397e526d66559bfabe6065223b1181a8a9d31e
Currently we use array_merge_recursive when merging any array, which is really
only needed for merging $wgHooks entries, and causes issues when trying to
merge default settings if the config is already set.
$wgHooks and $wgGroupPermissions are now special cased when merging, and all
other arrays are just +='d.
Bug: T88665
Bug: T89364
Change-Id: I773a9463d4428aa618c17f848c01b24e04610e95