registration: Overhaul merging of globals
authorKunal Mehta <legoktm@gmail.com>
Sat, 1 Aug 2015 07:38:27 +0000 (00:38 -0700)
committerKunal Mehta <legoktm@gmail.com>
Sun, 2 Aug 2015 19:04:25 +0000 (12:04 -0700)
commit1ebb0f5659667fd34c2c21ab2bb4068649d2ab07
tree26f0082e278d6a3924e4c479af0608b03e896a44
parentd75391883e9353f94c61e870618a1f48186cbb50
registration: Overhaul merging of globals

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
docs/extension.schema.json
includes/registration/ExtensionProcessor.php
includes/registration/ExtensionRegistry.php
tests/phpunit/includes/registration/ExtensionProcessorTest.php
tests/phpunit/includes/registration/ExtensionRegistryTest.php