LocalisationCache: Process one fallback at a time
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 3 Sep 2014 16:52:33 +0000 (12:52 -0400)
committerNiklas Laxström <niklas.laxstrom@gmail.com>
Thu, 4 Sep 2014 14:56:31 +0000 (16:56 +0200)
commitb6fc9067b0405603d250759cb73c41b8c8627d31
treecfbfc10a959aa850a10b4511b2959cbf2f21dea6
parent6ba93c256a74519b25c391dffe6a3085aaf1bc4f
LocalisationCache: Process one fallback at a time

Currently LocalisationCache merges the core data for all languages in
the fallback chain, then the extension data, then merges those two, and
then gives extensions like LocalisationUpdate a chance to make final
overrides with the LocalisationCacheRecache hook.

But if LocalisationUpdate doesn't want to locally duplicate all the
messages for every language (e.g. r104041), LocalisationCacheRecache is
too late: the information as to whether a message came from the primary
language or a fallback has been lost, so when LU itself has an override
for a fallback language it can't know whether or not the existing
message should be overridden or not.

The solution is for LocalisationCache to gather the data for each
fallback language separately, call a new hook for LU to affect just that
language (LocalisationCacheRecacheFallback), and only then merge the
fallback languages together.

Bug: 68781
Change-Id: Iacfe96063fcc66c1f97ca5e5292a8fc70af988cf
docs/hooks.txt
includes/cache/LocalisationCache.php
tests/phpunit/data/localisationcache/en.json [new file with mode: 0644]
tests/phpunit/data/localisationcache/ru.json [new file with mode: 0644]
tests/phpunit/data/localisationcache/uk.json [new file with mode: 0644]
tests/phpunit/includes/LocalisationCacheTest.php [deleted file]
tests/phpunit/includes/cache/LocalisationCacheTest.php [new file with mode: 0644]