Review main Merged

95171[BUGFIX] Store language pack state in JSON file

Andreas Kienast CR +2 V +2 Hard +572 −38 updated 09/03/26, 19:47

Commit message

In some setups, the language packs are updated during the deployment
process. Depending on the stage, the database may not be available yet.
This leads to errors during the deployment, because the
`LanguagePackService` attempts to store its state in the registry.

To remove the dependency to the database, the language pack state is now
stored into a JSON file within `var/labels` (or `typo3conf/l10n`). The
data is currently partially used in the Install Tool only.

This commit also side-fixes a bug that stored the update date of
localized packages only in an erroneous state.

Reads and writes of the JSON file are serialized through the core
locking API (`LockFactory`), so concurrent callers - for example a
parallel language pack download from the backend UI and a CLI run -
do not overwrite each other's changes. Bulk operations such as
`language:update` and the registry-to-JSON migration wizard batch
their writes into a single locked read-write cycle instead of one
per updated pack.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Georg Ringer +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Georg Ringer +1
    • Oliver Klee +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 6

Review log 1721

  1. Andreas Kienast uploaded patch set 1 08/07/26, 20:11

  2. core-ci voted on patch set 1 V +1 08/07/26, 20:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106139

  3. Garvin Hicking commented on patch set 1 08/07/26, 22:02

    LanguagePackStatesStore.php:24

    "StatesStore" feels a bit dopply mopply, how about just States OR Store?

    LanguagePackStatesStore.php:25

    Internal API?

    LanguagePackStatesStore.php:71

    Just curiosity, is this needed due to destruct usage or why is it a static methkd?
  4. Andreas Kienast commented on patch set 1 08/08/26, 04:54

    LanguagePackStatesStore.php:24 Reply

    I do not agree here. `LanguagePackStore` would handle the language packs. `LanguagePackStates` would represent the JSON file as a DTO.

    LanguagePackStatesStore.php:25 Reply

    Acknowledged

    LanguagePackStatesStore.php:71 Reply

    It's static because everything else in this method is static.
  5. Andreas Kienast uploaded patch set 2 V +1 08/08/26, 04:54

  6. core-ci voted on patch set 2 V +1 08/08/26, 05:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106159

  7. Garvin Hicking commented on patch set 2 CR +1 08/08/26, 07:04

    LanguagePackStatesStore.php:24 Reply

    Ack. Filed under "naming things" ;)

    LanguagePackStatesStore.php:71 Reply

    Acknowledged
  8. Mathias Brodala commented on patch set 2 08/10/26, 06:41

    I'd love to have an Important RST for this which clarifies the implication for the suggested workflow to have var/labels in VCS instead of updating it at runtime/deploy.
  9. Andreas Kienast commented on patch set 2 08/10/26, 08:24

    Reply

    I think there is a misunderstanding: this patch does not suggest/recommend a workflow, but fixes side-effects when using the language update in a specific context. An Important.rst makes perfectly sense to highlight that change, tho.
  10. Andreas Kienast uploaded patch set 3 CR +1 V +1 08/12/26, 12:19

  11. core-ci voted on patch set 3 V +1 08/12/26, 12:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106535

  12. Stefan Bürk commented on patch set 3 08/13/26, 18:59

    LanguagePackStatesStore.php:29

    This store (service) is not concurrent safe, for example dispatching multiple requests for different packs simulatnously in the UI ( backend/install tool) - and also together with possible parallel from the cli (scheduler command, cronjob). I'm not sure if the "load" -> internal state (propert) -> persist (load reads file only onces, and possible dropping other things later written meanwhile). I guess we should have here at least a "nearly" scoped `lock(wait) -> read -> update" loop - or at least on persiting the "file" should be locked, read, data merged / updated and written together -> unlock" as minimu. I guess this needs a deeper look, what do you think @akienast@scripting-base.de ?

    LanguagePackStatesStore.php:35

    Destruct is not really optimal for functional tests (we stumpeled upn that recently in other place(s) and was hard to debug and find. Not sure if we really should rely on that here. Beside that, I do not think that this "store" in that setup is really reliable, see generic / class comment.

    LanguagePackStatesStore.php:71

    With this condition, persists() only writes the file/content when it has already loaded something from the file OR this class has added something meanwhile. The condition is not really expressive on that double roule when to persist, and possible adding a comment here helps others on review or when coming back in the future.
  13. Andreas Kienast uploaded patch set 4 V +1 08/26/26, 09:59

  14. Andreas Kienast commented on patch set 4 08/26/26, 10:01

    Reply

    Done

    LanguagePackStatesStore.php:29 Reply

    Done

    LanguagePackStatesStore.php:35 Reply

    Done

    LanguagePackStatesStore.php:71 Reply

    Done
  15. core-ci voted on patch set 4 V +1 08/26/26, 10:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107132

  16. Stefan Bürk voted on patch set 4 CR +1 V +1 09/02/26, 10:49

  17. Oliver Klee voted on patch set 4 V +1 09/02/26, 11:09

  18. Simon Schaufelberger voted on patch set 4 CR +1 V +1 09/02/26, 18:36

  19. Georg Ringer voted on patch set 4 CR +1 V +1 09/03/26, 19:18

  20. Stefan Bürk voted on patch set 4 CR +2 V +2 09/03/26, 19:23

  21. Stefan Bürk merged patch set 5 09/03/26, 19:47