ResourceLoader: Fix SkinModule aliases to not override existing keys
While not documented or tested, aliases previously not only adding but also replaced values. Instead, emit a warning to inform skin developers of this conflict. Note that the `content-links => elements` alias already behaves this way (only if not already set), which the other aliases would now be consistent with. Change-Id: I66ae66b37bba14b2f65710f3d32f17d4e9a5a7a3
This commit is contained in:
parent
3d924e4ed1
commit
123da635a1
2 changed files with 15 additions and 1 deletions
|
|
@ -337,7 +337,11 @@ class SkinModule extends LessVarFileModule {
|
|||
|
||||
foreach ( self::COMPAT_ALIASES as $from => $to ) {
|
||||
if ( isset( $features[ $from ] ) && $to !== null ) {
|
||||
$features[ $to ] = $features[ $from ];
|
||||
if ( isset( $features[ $to ] ) ) {
|
||||
$messages .= "SkinModule feature `$from` conflicts with `$to` and was ignored. ";
|
||||
} else {
|
||||
$features[ $to ] = $features[ $from ];
|
||||
}
|
||||
}
|
||||
unset( $features[ $from ] );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,16 @@ class SkinModuleTest extends ResourceLoaderTestCase {
|
|||
],
|
||||
true
|
||||
],
|
||||
'Alias with conflict (content-thumbnails)' => [
|
||||
[
|
||||
'content-thumbnails' => true,
|
||||
'content-media' => false,
|
||||
],
|
||||
[
|
||||
'content-media' => false,
|
||||
],
|
||||
true
|
||||
],
|
||||
'Alias that no-ops (legacy)' => [
|
||||
[
|
||||
'toc' => true,
|
||||
|
|
|
|||
Loading…
Reference in a new issue