Review 9.5 Abandoned

69730[BUGFIX] No hrefLang if language enabled is false

Jonathan IROULIN CR 0 V 0 Easy +15 −1 updated 10/03/21, 14:54

Commit message

Check if language is enabled in config.yaml file.

If « enabled » attribute is missing or is « true », it generate hrefLang.
If « enabled » attribute is set to false, it don’t generate hrefLang.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 1

Review log 2636

Show 611 earlier messages
  1. Jonathan IROULIN uploaded patch set 1 07/06/21, 16:09

  2. core-ci voted on patch set 1 V -1 07/06/21, 16:11 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13028

  3. Jonathan IROULIN uploaded patch set 2 07/07/21, 08:23

  4. core-ci voted on patch set 2 V +1 07/07/21, 08:34 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13045

  5. Richard Haeser updated the commit message in patch set 3 07/07/21, 08:53

  6. Geert Boetzkes commented on patch set 3 07/07/21, 09:00

    Code looks good, but there are some optimization opportunities.

    HrefLangGenerator.php:88 Unresolved

    I suggest starting with the $isLanguageEnabled, if the variable is false the comparison is way lighter. ``` if ($isLanguageEnabled && $language['available'] === 1 && !empty($language['link'])) { ```

    HrefLangGenerator.php:157 Unresolved

    Using the array_method the code could be way faster: ``` return array_map(static function ($language) { return $language->getLanguageId(); }, $this->request->getAttribute('site')->getLanguages()); ```
  7. core-ci voted on patch set 3 V +1 07/07/21, 09:03 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13046

  8. Jonathan IROULIN uploaded patch set 4 07/09/21, 14:28

  9. core-ci voted on patch set 4 V -1 07/09/21, 14:30 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13153

  10. Jonathan IROULIN uploaded patch set 5 07/09/21, 14:32

  11. core-ci voted on patch set 5 V +1 07/09/21, 14:41 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13154

  1. Mathias Brodala commented on patch set 5 CR -1 07/09/21, 15:06

    HrefLangGenerator.php:87

    The 3rd argument for in_array() (true for strict type checking) is missing here.

    HrefLangGenerator.php:157

    This comment does not perform any checks but reduces SiteLanguage objects to their language ID ...
  2. Jonathan IROULIN uploaded patch set 6 07/12/21, 07:53

  3. Jonathan IROULIN commented on patch set 6 07/12/21, 07:57

    Unresolved

    Hello Mathias, Thank you for your comments. I added the "true" argument to "in_array()" For the second comment, can you explain me what could i do to resolve your comment ?

    HrefLangGenerator.php:87 Reply

    Thank you Mathias, i'll add

    HrefLangGenerator.php:157 Reply Unresolved

    Do you mean that we should just change the name of the method ? Or something else ? What do you think would be the right name?
  4. core-ci voted on patch set 6 V +1 07/12/21, 08:04 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13205

  5. Jonathan IROULIN uploaded patch set 7 07/15/21, 07:03

  6. core-ci voted on patch set 7 V +1 07/15/21, 07:15 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13349

  7. Henrik Elsner commented on patch set 7 07/15/21, 12:19

    your commit message is missing a bracket
  8. Oliver Klee commented on patch set 7 07/15/21, 13:17

    Is this 9.5-only, i.e., 10.4 and master are note affected by the problem?
  9. Jonathan IROULIN updated the commit message in patch set 8 07/15/21, 13:36

  10. Jonathan IROULIN commented on patch set 8 07/15/21, 13:43

    Reply

    Thank you, i added

    Reply

    I don't know yet because our site is on 9.5. I looked the code on 10.4 and it seems that the requestSiteLanguage are not verified. So i think the problem affect these versions but i am not sure.
  11. core-ci voted on patch set 8 V +1 07/15/21, 13:46 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13358

  12. Oliver Klee commented on patch set 8 07/15/21, 15:00

    Reply

    Then we need to verify this. (The workflow is to create the change for master first with the relevant branches listed in the "Releases:" line, and that backport the change after the master change has been merged.)

    HrefLangGenerator.php:87 Unresolved

    Could we cover this change with a regression test to make sure it works as advertised (and won't break later)?
  13. Jonathan IROULIN commented on patch set 8 07/15/21, 15:34

    Reply

    Ok, do you want i test on a ddev and introduction Package 10.4 ? Or you trying ?
  14. Oliver Klee commented on patch set 8 07/15/21, 17:04

    Reply

    Please do. (I'm currently working on something different.) Thanks!
  15. Jonathan IROULIN commented on patch set 8 07/16/21, 15:03

    Reply

    Version 10.4 is also affected. I will try to do a patch. Does i need to open an other ticket or just update the "Releases" line ?
  16. Oliver Klee commented on patch set 8 07/16/21, 15:59

    Reply Unresolved

    Updating the "Releases" line should suffice: Releases: master, 10.4, 9.5
  17. Jonathan IROULIN updated the commit message in patch set 9 07/16/21, 16:18

  18. core-ci voted on patch set 9 V +1 07/16/21, 16:28 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13398

  19. Georg Ringer commented on patch set 9 07/18/21, 06:05

    HrefLangGenerator.php:152 Unresolved

    so this could be int[] to have better type information
  20. Jonathan IROULIN uploaded patch set 10 07/19/21, 05:56

  21. core-ci voted on patch set 10 V +1 07/19/21, 06:08 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13467

  22. Geert Boetzkes voted on patch set 10 CR +1 07/19/21, 12:07

  23. Riny van Tiggelen commented on patch set 10 V -1 CR -1 07/19/21, 15:16

    I'm not able to reproduce this problem, isn't there something different in your installation which causes this problem? The HrefLangGenerator uses the HMENU with special=languages, this retrieves the languages from the Site Entity (getLanguages) and the check for enabled is done there. If the problem does exist, the change needs to be done in a different area but not within the HrefLangGenerator.
  24. Jonathan IROULIN commented on patch set 10 07/19/21, 17:37

    Thank you Riny for your comment. I will update "How to reproduce" ticket section

    Reply Unresolved

    Hello, If you take one TYPO3 installation with two site : - "Site A" with 4 languages (these languages are in database and on "siteA.yaml" file) - "Site B" with 3 of the 4 "site A" languages (these languages are in "siteB.yaml" file. But you choose to disable 1 of the 3 languages) On your "site B", you create a "mount point" page "page-B" to a page "page-A" from "Site A". Now if you browse the "page-B" not on the main language you should see in source code that there are "<link rel="alternate" hreflang=" link to the "page-B" for the language you disabled from "siteb.yaml" file. So when you crawl the "site B" you have 404 page because the requested site (site B) have less languages than the "Site A" where the mount point go because hrefLangGenerator doesnt check the languages available on the requested site. I will update the ticket with "how to reproduce".
  25. Benni Mack abandoned the change 10/03/21, 14:54

    This change is abandoned as there is no upcoming free-of-charge 9.5 release anymore. Let's concentrate on the master/10.4 changes