Review main Merged

77939[TASK] Display PHP_VERSION in CLI

Thomas Hohn CR +2 V +2 Easy +41 −7 updated 03/02/23, 17:59

Commit message

Display PHP_VERSION after TYPO3 version number and current
Application Context in CLI requests.

Review

  • Code review CR +2 Done
    • Anja Leichsenring +2
    • Nikita Hovratov +2
  • Verified V +2 Done
    • Anja Leichsenring +2
    • Nikita Hovratov +2
    • core-ci +1 CI

Issues 1

Files 2

Review log 5972

Show 3747 earlier messages
  1. Thomas Hohn uploaded patch set 1 02/24/23, 06:30

  2. core-ci voted on patch set 1 V +1 02/24/23, 06:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38039

  3. Chris Müller commented on patch set 1 02/24/23, 08:33

    As it is a feature it can't go into 11.5
  4. Thomas Hohn updated the commit message in patch set 2 V +1 02/24/23, 08:35

  5. Thomas Hohn commented on patch set 2 02/24/23, 08:35

    Reply

    Fixed
  6. core-ci voted on patch set 2 V +1 02/24/23, 08:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38041

  7. Simon Schaufelberger voted on patch set 2 V +1 CR +1 02/24/23, 10:55

  8. Stefan Bürk commented on patch set 2 CR -1 02/24/23, 11:30

    Reply

    That was the reason why benni suggested to make it a task. But let's take it for now as a feature.

    CommandApplication.php:75

    Not really happy with the formatting. Would would you say, if * it is in the same line with the TYPO3 + context version * and more important having ing with PHP CLI as normal like TYPO3 CMS and using `<comment></comment>` for the PHP_VERSION part ? See https://postimg.cc/4mH9BDp2 -1 for the coloring , first one is only soft remark/question
  9. Thomas Hohn commented on patch set 2 02/24/23, 11:44

    Reply

    If we can "backport" it as a TASK and have the information on the same line I will happily change it 😊

    CommandApplication.php:75 Reply

    Hi - no problem with that - will update it :)
  10. Thomas Hohn uploaded patch set 3 CR +1 V +1 02/24/23, 11:57

  11. Thomas Hohn commented on patch set 3 02/24/23, 11:58

    Reply

    Changed it into a task

    CommandApplication.php:75 Reply

    Fixed coloring and moved info to same line
  12. core-ci voted on patch set 3 V +1 02/24/23, 12:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38050

  13. Oliver Klee commented on patch set 3 02/24/23, 12:49

    CommandApplication.php:72

    I generally recommend using numbered placeholders for sprintf calls with multiple placeholders. This allows reordering the values in the output without having to change the call: ``` '%1$s (Application Context: <comment>%2$s</comment>)' . ' %3$s %4$s', ``` Reference for this: https://www.php.net/manual/en/function.sprintf.php

    CommandApplication.php:76

    To make things consistent, I think moving all the (HTML) tags from the values to the `$format` string would be helpful.
  14. Thomas Hohn commented on patch set 3 02/24/23, 12:57

    CommandApplication.php:72 Reply

    Nice :-)

    CommandApplication.php:76 Reply

    Will look at it
  15. Thomas Hohn uploaded patch set 4 V +1 02/24/23, 15:19

  16. Thomas Hohn commented on patch set 4 02/24/23, 15:21

    CommandApplication.php:72 Reply

    Done

    CommandApplication.php:76 Reply

    Done
  17. core-ci voted on patch set 4 V +1 02/24/23, 15:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38062

  18. Stefan Bürk commented on patch set 4 02/24/23, 15:32

    CommandApplication.php:72

    Please, avoid the "fg" color setting here. See image link: thats not really readable on terminals with black background. Simple use %3$s as "label" .. like for TYPO3 CMS. https://postimg.cc/p9rN7HXF -1 thats not really usable for dark living linux people
  19. Thomas Hohn commented on patch set 4 02/24/23, 15:49

    CommandApplication.php:72 Reply

    If there is no explicit color tag the color of PHP CLI will be "green" since the 'TYPO3 CMS' is styled by Symfony
  20. Thomas Hohn commented on patch set 4 02/24/23, 16:05

    CommandApplication.php:72 Reply

    Then we would need to change it to TYPO3 CMS 11.5.24 PHP CLI 8.1.15 (Application Context: Production)
  21. Stefan Bürk uploaded patch set 5 V +1 02/24/23, 23:06

  22. Stefan Bürk commented on patch set 5 02/24/23, 23:07

    CommandApplication.php:72 Reply

    Have a look. Changed it slightly.
  23. core-ci voted on patch set 5 V +1 02/24/23, 23:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38074

  24. Thomas Hohn commented on patch set 5 02/25/23, 07:18

    CommandApplication.php:72 Reply

    Hi - Personally I would prefer not to close tags that could theoretically change. If you parse the line a bit clever to extract the information - it shouldn't rely on the position of items. I would prefer the following: $this->application = new Application( sprintf( '%1$s <info>%2$s</info> %3$s <info>%4$s</info>', 'TYPO3 CMS', (new Typo3Version())->getVersion(), 'PHP', PHP_VERSION ), sprintf( '(Application Context: <comment>%1$s</comment>) (SAPI: <comment>%2$s</comment>)', Environment::getContext(), PHP_SAPI ) ); Putting TYPOO and PHP + versions in the first argument and then provide additional information like Context and SAPI as "version"
  25. Stefan Bürk commented on patch set 5 02/25/23, 09:41

    CommandApplication.php:72 Reply

    Symfony does basically following to display the first line: ``` %APPLICATION_NAME% <info>%APPLICATION_LONG_VERSION%</info> ``` The longversion is build from the version. Therefore, I closed the </info> to get the same colering as the default text, and reopening it. Granted, doing it like my suggestion seems off - but way better then putting stuff like version into "name", that seems really ugly. I just want to avoid a explicit FG without BG setting. And doing both is weired anyway. Don't now if there is something to reset to default .. using white would be uncool the other way round, I guess. I would still go vor the closing and reopenening. Abusing the application name I would avoidat all, as it may be reused and than weired behaviour bubbles up to have version information in a name.
  26. Thomas Hohn uploaded patch set 6 V +1 02/25/23, 12:43

  27. Thomas Hohn uploaded patch set 7 02/25/23, 12:52

  28. Thomas Hohn commented on patch set 7 02/25/23, 12:53

    CommandApplication.php:72 Reply

    I believe patchset 7 solves the issue in a "safe" way
  29. core-ci voted on patch set 6 V +1 02/25/23, 12:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38088

  30. Thomas Hohn uploaded patch set 8 02/25/23, 13:06

  31. core-ci voted on patch set 7 V +1 02/25/23, 13:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38090

  32. core-ci voted on patch set 8 V +1 02/25/23, 13:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38092

  33. Stefan Bürk commented on patch set 8 V +1 CR +1 02/26/23, 01:33

    CommandApplication.php:72 Reply

    I'm more for Patchset 8 then 7. Therefor closing now and voting. Thank you.
  34. Helmut Hummel commented on patch set 8 02/27/23, 09:33

    CommandApplication.php:72

    This now starts becoming a bit convoluted. How about creating a custom Application class, that inherits from the base class and implementing getLongVersion()? e.g.: https://github.com/TYPO3-Console/TYPO3-Console/blob/a586c4796939f774ba1c873a087d18072d515469/Classes/Console/Mvc/Cli/Symfony/Application.php#L39-L56

    CommandApplication.php:77

    Not sure, but do we really need the SAPI here? Should be "cli" 99% of the time, right? Or is there some use case I am missing?
  35. Thomas Hohn commented on patch set 8 02/27/23, 09:42

    CommandApplication.php:72 Reply

    Oh - that looks way more elegant :-)
  36. Stefan Bürk commented on patch set 8 02/27/23, 09:51

    CommandApplication.php:72 Reply

    Saw your work with your console tonight @Helmut - had the same thought afterwards. And I guess having a "Application" override would be fine for it even as backport - or ?

    CommandApplication.php:77 Reply

    There have been quite some people on the cms channel having issues with cli and/or composer ... and having hosting provides which has the "fcgi" binary as "php" / "php7.4" / "php8.1" .. and the cli as "php-cli", "php7.4-cli" and so on. Meaning they invoking the cli scripts with the wrong binary. Thomas had a hardcoded "PHP CLI" (or similar) in there, and I decided that if we add php here at all it would make sense to add the SAPI. In the end, I would not insist on that - as long as not hardcoded "PHP-CLI" is used hardcoded then.
  37. Helmut Hummel commented on patch set 8 02/27/23, 10:02

    CommandApplication.php:72 Reply

    Yes, I would say so. Overriding the Application is public SF API and CommandApplication is private TYPO3 API, so should be fine.
  38. Helmut Hummel commented on patch set 8 CR -1 02/27/23, 10:07

  39. Thomas Hohn uploaded patch set 9 CR +1 V +1 02/27/23, 10:32

  40. Thomas Hohn commented on patch set 8 02/27/23, 10:32

    CommandApplication.php:77 Reply

    Will remove it then 😊
  41. Thomas Hohn commented on patch set 9 02/27/23, 10:57

    CommandApplication.php:72 Reply

    Ack
  42. Helmut Hummel commented on patch set 9 02/27/23, 11:11

    Application.php:35

    minor nitpick: that concatenation could be removed

    CommandApplication.php:68

    also only a minor thing: the Application constructor accepts the version as second argument. Why did you opt to not use it?
  43. Thomas Hohn commented on patch set 9 02/27/23, 11:17

    Application.php:35 Reply

    Ack

    CommandApplication.php:68 Reply

    Hi - you could - if it's omitted it will just return the application name or elsen if ('UNKNOWN' !== $this->getName()) { if ('UNKNOWN' !== $this->getVersion()) { return sprintf('%s <info>%s</info>', $this->getName(), $this->getVersion()); } return $this->getName(); } So what would you parse as version?
  44. core-ci voted on patch set 9 V +1 02/27/23, 11:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38148

  45. Helmut Hummel commented on patch set 9 02/27/23, 14:04

    CommandApplication.php:68 Reply

    I'll put the version in there so that Application->getVersion() only returns the version and do all desired formatting for the "long version" in Application->getLongVersion()
  46. Thomas Hohn uploaded patch set 10 V +1 02/27/23, 14:27

  47. core-ci voted on patch set 10 V +1 02/27/23, 14:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38158

  1. Thomas Hohn commented on patch set 10 02/27/23, 14:35

    Application.php:35 Reply

    Done

    CommandApplication.php:68 Reply

    Done
  2. Helmut Hummel commented on patch set 10 02/27/23, 16:58

    Besides the small remaining nitpick, this looks smooth for me now, thanks a lot for your patience!

    Application.php:36

    so sorry for nitpicking all the time, but this can be $this->getName() and $this->getVersion(), since we don't override the methods here with the need to explicitly call the parent version of the method
  3. Helmut Hummel commented on patch set 10 02/27/23, 17:00

    Application.php:34

    oh, one thing here still, I'm not quite sure nesting these tags works smoothly. I will test this quickly.
  4. Helmut Hummel uploaded patch set 11 V +1 02/27/23, 17:16

  5. Helmut Hummel commented on patch set 11 V +1 CR +1 02/27/23, 17:17

    Here is my suggestion. Does it work for everybody?
  6. Helmut Hummel commented on patch set 11 02/27/23, 17:17

    Application.php:34 Reply

    Done

    Application.php:36 Reply

    Done
  7. core-ci voted on patch set 11 V +1 02/27/23, 17:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38165

  8. Josef Glatz commented on patch set 11 V +1 CR +1 02/27/23, 20:04

    Works for me under macOS and linux
  9. Thomas Hohn commented on patch set 11 02/27/23, 20:48

    Application.php:36 Reply

    NP - it's a part of the learning process ;-)
  10. Simon Schaufelberger commented on patch set 11 02/27/23, 21:15

    Application.php:29

    don't we omit the return type if it doesn't add any extra information for phpstan?
  11. Thomas Hohn uploaded patch set 12 CR +1 V +1 02/27/23, 21:35

  12. Thomas Hohn commented on patch set 11 02/27/23, 21:36

    Application.php:29 Reply

    Seems so - fixed
  13. core-ci voted on patch set 12 V +1 02/27/23, 22:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38176

  14. Stefan Bürk commented on patch set 12 02/27/23, 22:55

    CommandApplication.php:77 Reply

    Ehm .. Helmut, that was a good step. The CommandApplication errors out if SAPI is not cli anyway 😂
  15. Simon Schaufelberger voted on patch set 12 CR +1 02/28/23, 00:34

  16. Josef Glatz voted on patch set 12 V +1 CR +1 02/28/23, 05:43

  17. Torben Hansen voted on patch set 12 V +1 CR +1 03/02/23, 17:42

  18. Nikita Hovratov uploaded patch set 13 CR +1 V +1 03/02/23, 17:49

  19. Nikita Hovratov voted on patch set 13 V +1 CR +1 03/02/23, 17:50

  20. Anja Leichsenring voted on patch set 13 V +1 CR +1 03/02/23, 17:55

  21. core-ci voted on patch set 13 V +1 03/02/23, 17:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/38317

  22. Anja Leichsenring voted on patch set 13 CR +2 03/02/23, 17:59

  23. Anja Leichsenring voted on patch set 13 V +2 03/02/23, 17:59

  24. Nikita Hovratov voted on patch set 13 V +2 CR +2 03/02/23, 17:59

  25. Anja Leichsenring merged patch set 14 03/02/23, 17:59