Problem/Motivation
Follow-up to #2625258: LocaleConfigManager::updateConfigTranslations() deletes translations if a config object's name happens to match that of a shipped configuration object which adds a hash to configuration files. We need to provide a upgrade path for existing sites.
Proposed resolution
Discussed with @catch and @Gábor Hojtsy. We agreed that the upgrade path should:
- check all active config and if name does not match - do not add hash
- If name matches but has custom config translations - do NOT add hash
- Otherwise add hash.
This way we don't get data loss and most sites will get localisations for default config.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
Existing configuration entities created through the installer have a default_config_hash key set.
Comment | File | Size | Author |
---|---|---|---|
#36 | 2628004-nr-bot.txt | 144 bytes | needs-review-queue-bot |
#28 | interdiff_24-28.txt | 5.14 KB | snehalgaikwad |
#28 | 2628004-28.patch | 7.44 KB | snehalgaikwad |
#24 | interdiff-22-24.txt | 1.26 KB | Hardik_Patel_12 |
#24 | 2628004-24.patch | 7.36 KB | Hardik_Patel_12 |
Comments
Comment #2
MustangGB CreditAttribution: MustangGB commentedComment #3
tstoecklerCan't we actually hash the config in
ExtensionInstallStorage
and the config in "ActiveStorage
" and only add the hash if the hashes match?Comment #4
alexpottWell means any change to non-translated things will stop you getting the new translations
Comment #5
tstoecklerAhh right. Hmm... but that means that people who have deleted e.g. the
frontpage
view and have recreated one with the same name, still get the data loss problem, right? Hard tradeoff to make, not necessarily disagreeing with the issue summary, just wanted to pinpoint this.Comment #6
alexpott@tstoeckler yep it is tricky - I'm not sure what the best approach is tbh
Comment #7
alexpottThe biggest problem is knowing what to hash. We can't hash the active config because it might have changed. And hashing the default config provided by modules / profiles is tricky because whilst I don't think we've changed any default configuration files since 8.0.0 sites might be older than that. And they might change in the future. Also what about contrib? Default config has certainly changed there.
I'm not sure there is any reliable way of working this out. So the question is what would be the impact of doing something like this...
This way we'll know we can't use this information to work out which version of the extension's default config was installed BUT if the config has a translatable value that still matches the default value as determined by locale/config_translation then automatic translation will work because the system will consider it shipped config.
Comment #8
xjm@alexpott and I discussed this issue more. We have left this issue critical up to now for two reasons:
However, the workaround of manually translating this comparatively small subset of strings is available, and the issue does not meet any of the criteria for a critical issue on its own. Therefore, dowgrading to major.
Per @alexpott, we might also be able to make progress by separating this issue into two parts and handling the simple config case first.
Comment #9
alexpottHere's a starter - it's not yet working out if the translations are custom config translations. I think we need to look up locale tables to find out if the translation is a default translation or a custom one. Some guidance here would be helpful.
Comment #10
Kristen PolThanks for the patch. I know you are still working on this and need to sort out the default vs custom logic but I scanned the code for other things which could be addressed when the patch is updated next.
Is this the best way to reference this file?
Typo: updateed => updated
It would be nice to have some comments for this logic similar to what's in the other test.
Is this the best way to reference this file?
Unclear wording.
Nitpick: Extra line.
Nitpick: Configuration => config (or vice versa) for consistency.
Comment #19
Kristen PolPatch no longer applies and needs a reroll.
Comment #20
Kristen PolComment #21
Kristen PolComment #22
Hardik_Patel_12 CreditAttribution: Hardik_Patel_12 at QED42 for Drupal India Association commentedRe-rolled against 9.1.x. Kindly review a patch.
Comment #24
Hardik_Patel_12 CreditAttribution: Hardik_Patel_12 at QED42 for Drupal India Association commentedSolving failed test cases , kindly review.
Comment #25
Hardik_Patel_12 CreditAttribution: Hardik_Patel_12 at QED42 for Drupal India Association commentedForgot to change status , moving to needs review.
Comment #26
Kristen PolThanks for the update. I have reviewed for formatting and general issues but not for overall logic and found a few things.
Needs comment.
Needs description.
Nitpick: Add empty line between namespace and use lines.
Needs to be updated to
drupal-8.8.0.bare.standard.php.gz
.Needs description.
Nitpick: Add empty line between namespace and use lines.
Needs to be updated to
drupal-8.8.0.filled.standard.php.gz
.Nitpick: Change to get to one line, e.g.
The system.mail has no translations so it should use the fake hash.
Nitpick: Not alphabetical.
Nitpick: Extra empty lines.
Needs description.
Nitpick: Extra empty line.
Update to be a sentence.
Comment #27
snehalgaikwad CreditAttribution: snehalgaikwad at QED42 for Drupal India Association commentedComment #28
snehalgaikwad CreditAttribution: snehalgaikwad at QED42 for Drupal India Association commentedComment #30
Kristen PolTests are passing now and tests were added to the patch.
Comment #36
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.