-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix translation override cache invalidation #22394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 11.0/bugfixes
Are you sure you want to change the base?
Conversation
AdrienClairembault
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if theses files are supposed to be modified manually in between official releases.
Isn't the solution to just let the user clean his cache if he does so?
3c3f99e to
9f41f6d
Compare
Agree |
|
#22377 (comment) User already cleared the cache (CLI + GUI) and it does not seems to work. Without the override hash in the cache key, the key stays identical before/after adding override files, so cache clearing alone doesn't force a proper reload. I think this modification is relevant. In addition, the changes in the cache behaviour is targeted only on languages. |
tests/functional/SessionTest.php
Outdated
| unlink(GLPI_LOCAL_I18N_DIR . '/core/en_GB.mo'); | ||
| } | ||
|
|
||
| public function testTranslationOverrideCacheInvalidation() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is green without the fix
trasher
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not tested, loadLanguage seems correct; but getOverrideFilesHash shoudl be tested (if not possible to test really, at least this hash calculation should be).
It seems wrong, look at this unrelated PR I've worked on yesterday: https://github.com/glpi-project/glpi/pull/22436/changes After re-enabling the translation cache for the units tests, I've had to update a test that modify the locales files. I don't think the user in the original issue cleared the cache properly tbh. |
|
getOverrideFilesHash() method is private static, so it cannot be tested directly without reflection (which GLPI test suite doesn't use). However, testLocalI18nCacheInvalidation() indirectly proves the hash logic works correctly |
I see several use of |
#22377
Fixes cache issue for translation override: Include override files hash in Translator cache key to ensure cache is invalidated when locale override files are modified.