Review main Work in progress Orphaned

79266[FEATURE] Add DefaultLanguageRestriction

Stefan Froemken CR 0 V 0 Normal +128 −0 updated 03/31/25, 18:55

Commit message

Nearly all record based methods of `PageRepository`
and `BackendUtility` like `versionOL`,
`getLanguageOverlay` and `getRawRecord` need a
record as argument in default language to work
properly.
The new `DefaultLanguageRestriction` can be added
to TYPO3 QueryBuilder to add needed WHERE clause
for selecting records in default language
only.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 6
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/66/79266/6 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/66/79266/6 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Issues 1

Files 3

Review log 1723

  1. Stefan Froemken uploaded patch set 1 06/12/23, 19:35

  2. core-ci voted on patch set 1 V -1 06/12/23, 19:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42400

  3. Stefan Froemken uploaded patch set 2 V -1 06/12/23, 19:45

  4. core-ci voted on patch set 2 V -1 06/12/23, 19:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42401

  5. Stefan Froemken uploaded patch set 3 V -1 06/12/23, 20:03

  6. core-ci voted on patch set 3 V +1 06/12/23, 20:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42402

  7. Stefan Bürk commented on patch set 3 06/12/23, 21:44

    Feature is main only. No backports. TBH not reviewed yet.
  8. Stefan Bürk voted on patch set 3 CR -1 06/12/23, 21:45

  9. Anja Leichsenring commented on patch set 3 06/13/23, 04:44

    I don't get the restriction. Default language is always 0, so why do you ask for '>= 0' ? And 'l10nParent' might be zero anyway, think free mode. That will it not make a default language record. Some more information about how you ended up with the restrictions you built would be helpful to verify.
  10. Stefan Froemken commented on patch set 3 06/13/23, 05:38

    Reply

    Hi Anja, I ask for <= 0. Also records with -1 are part of records in default language. I have used official TYPO3 API to get records in default language: https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php#L2511-L2524
  11. André Buchmann commented on patch set 3 CR -1 05/25/24, 06:30

    Unresolved

    I've implemented almost the same DefaultLanguageRestriction in my Patch here: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84338 Thx to Gerrit for showing the Conflict :-) --- I think we shouldn't use the hardcoded 0 as default language, but fetch it from the site configuration. This way this patch can be a prepatch for my patch.
  12. Stefan Froemken updated the commit message in patch set 4 CR -1 V +1 06/23/24, 14:09

  13. Stefan Froemken rebased onto patch set 5 06/23/24, 14:10

  14. core-ci voted on patch set 5 V -1 06/23/24, 14:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60109

  15. Stefan Froemken uploaded patch set 6 V -1 06/23/24, 14:24

  16. core-ci voted on patch set 6 V +1 06/23/24, 14:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60112

  17. Georg Ringer commented on patch set 6 06/23/24, 14:38

    so what about the famous & ugly -1 language?
  18. Stefan Froemken commented on patch set 6 06/23/24, 15:27

    Reply

    I keep it in sync with extbase queries. If it will be changed there, I'm ready to update it here, too.
  19. core-ci voted on patch set 4 V -1 06/23/24, 18:00 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60108

  20. Anja Leichsenring wrote 07/31/24, 18:16

    Removed cc Anja Leichsenring.
  21. Benni Mack commented on patch set 6 03/27/25, 17:34

    I'd very much be in favor of actually using the LanguageAspect for constructing the query - but I still do not get the need for it (like... the actual use cases). I don't know: a) if you are in Frontend Context, Extbase + PageRepository do the job for you b) if you are in Backend, I am not sure when you "only" want the default language records (but not ALL languages?)

    Reply

    which Extbase Queries?

    DefaultLanguageRestriction.php:41 Unresolved

    1. Using isTableLocalizable() should be avoided. You are adding a (yet another) explicit dependency from EXT:backend to EXT:core by using this code.
  22. Benni Mack marked it work in progress 03/27/25, 17:34

  23. Benni Mack commented on patch set 6 03/31/25, 18:55

    Also see https://forge.typo3.org/issues/91247 "FrontendLanguageRestriction"