Review main Merged

86438[BUGFIX] Display all languages state in `site:list` command

Josef Glatz CR +2 V +2 Easy +1 −1 updated 10/14/24, 07:48

Commit message

This change modifies the `site:list` command to retrieve
and display all languages for sites and not only enabled
languages for the frontend. Thus, showing the enabled or
disabled state makes sense again.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1619

  1. Josef Glatz uploaded patch set 1 10/06/24, 12:33

  2. Josef Glatz commented on patch set 1 10/06/24, 12:36

    This change is ready for review.
    Hey, I hope extending the existing method `\TYPO3\CMS\Core\Site\Entity\Site::getLanguages` is the way to go. In my opinion, it is the right way to extend the method, as the method description already suggests that you can get all languages ​​in this way, and not just active languages.
  3. Josef Glatz commented on patch set 1 10/06/24, 12:38

    ...and please check the before/after CLI-screenshots: https://forge.typo3.org/issues/105209?next_issue_id=105208#Before
  4. core-ci voted on patch set 1 V +1 10/06/24, 12:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67183

  5. Josef Glatz commented on patch set 1 10/06/24, 13:10

    PS: if it's OK: I would also target 12.4 branch. What do you guys think?
  6. Garvin Hicking commented on patch set 1 10/07/24, 05:57

    Reply

    It's a non-breaking change to add new parameters, I think that's fair. However we should better cover this new method with a test, and a fixture that uses disabled languages for a site, what do you think?

    Reply

    Would be fine for me, I think a possible negative impact is unlikely.

    SiteListCommand.php:66

    We cannot use named Parameters here, it's only allowed for PCPP or on value objects constructors. Just "true" would be enough here :)
  7. Josef Glatz commented on patch set 2 V +1 10/09/24, 08:44

    Published edit on patch set 1.
  8. Josef Glatz commented on patch set 2 10/09/24, 08:45

    Reply

    sounds great. however: where do I have to start to create such a test scenario? could you please give me some advice via slack?

    SiteListCommand.php:66 Reply

    Acknowledged
  9. core-ci voted on patch set 2 V +1 10/09/24, 08:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67423

  10. Garvin Hicking commented on patch set 2 10/09/24, 09:52

    Reply

    Sure; I did. Just to document it here. What should be done is to use https://github.com/TYPO3/typo3/blob/36b63a8c109a5a805e1835f67cf56d1a746f3bcc/typo3/sysext/core/Tests/Unit/Site/Entity/SiteTest.php as a starting base, create a new testcase: - Create a config array also containing disabled languages for a constructore call to new Site() - Add an assertion to $subject->getLanguages() that only contains enabled languages - Add an assertion to $subject->getLanguages(true) that will also contain the disabled languages HTH! :)
  11. Josef Glatz commented on patch set 2 CR -1 10/09/24, 09:55

    Reply

    Acknowledged
  12. Stefan Bürk commented on patch set 2 10/09/24, 10:01

    Reply

    Don't add a flag / change `getLanguages()`, even if not breaking. Simply use `getAllLanguages()` for it which returns all langugas, enabled or not. The code in the command alrady reads `isEnabled()` anyway of retrieved language object. No need to make getLanguage() conditional based the same method as `getAllLanguages()`. Thus -1 on this change. Note using `getAllLanguages()` instead of adding this argument should allow backporting this change also to 12.4 as bugfix.
    -1 see other comments. Please solve this in another way without changing a method argument.

    SiteListCommand.php:66

    Nope. Use `->getAllLanguages()` instead.

    Site.php:228

    We will not add this method argument here. If "all" languages are needed, use `getAllLanguages()` instead. That method result can be used to filter even only disabled languages. This method surfes a special purpose and extension author's should not use this special meaning method. However, I would correct the PHP-docblock to ``` Returns all enabled languages site languages for the frontend. ```
  13. Josef Glatz commented on patch set 2 10/09/24, 10:03

    Thank you Stefan! Overseen that!!!
  14. Stefan Bürk uploaded patch set 3 CR -1 V +1 10/14/24, 04:58

  15. Stefan Bürk commented on patch set 3 10/14/24, 04:59

    Reply

    Reverted and used correct method to retrieve all languages in the command, added 12.4 as backport target again.

    Reply

    Done

    SiteListCommand.php:66 Reply

    Done

    Site.php:228 Reply

    Done
  16. core-ci voted on patch set 3 V +1 10/14/24, 05:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67733

  17. Garvin Hicking voted on patch set 3 CR +1 V +1 10/14/24, 06:48

  18. Stefan Bürk voted on patch set 3 CR +2 V +2 10/14/24, 07:33

  19. Stefan Bürk merged patch set 4 10/14/24, 07:48