Review main Merged

79257[BUGFIX] Respect default values in setup command

Johannes Nielsen CR +2 V +2 Easy +10 −4 updated 07/06/23, 18:22

Commit message

So far the setup command did not consider default values in
non-interactive mode. This led to unexpected errors when
not passing in parameters, which should have default values,
as either CLI parameters or ENV variables.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Jochen Roth +1
    • Markus Klein +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Benni Mack +2
    • Jochen Roth +1
    • Markus Klein +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 2026

Show 1 earlier messages
  1. Johannes Nielsen uploaded patch set 1 06/12/23, 08:28

  1. core-ci voted on patch set 1 V +1 06/12/23, 08:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42375

  2. Markus Klein updated the commit message in patch set 2 V +1 06/12/23, 09:15

  3. Markus Klein voted on patch set 2 CR +1 06/12/23, 09:19

  4. core-ci voted on patch set 2 V +1 06/12/23, 09:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42378

  5. Jochen Roth commented on patch set 2 CR -1 06/12/23, 10:12

    Looking at it. Will give some feedback soon.
  6. Sybille Peters voted on patch set 2 V +1 06/12/23, 17:05

  7. Jochen Roth uploaded patch set 3 CR +1 V +1 06/13/23, 08:42

  8. Jochen Roth uploaded patch set 4 06/13/23, 08:47

  9. core-ci voted on patch set 3 V -1 06/13/23, 08:50 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42438

  10. Jochen Roth commented on patch set 4 06/13/23, 08:52

    Changed it so 'admin-username' and 'admin-email' respect the default values too
  11. Jochen Roth uploaded patch set 5 06/13/23, 08:53

  12. core-ci voted on patch set 4 V -1 06/13/23, 08:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42439

  13. core-ci voted on patch set 5 V +1 06/13/23, 09:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42440

  14. Sybille Peters commented on patch set 5 06/13/23, 09:02

    SetupCommand.php:113

    Is "admin" a good default username? Since this is now changed to optional, it is more relevant. I think for security reasons this is not the best idea.
  15. Jochen Roth commented on patch set 5 06/13/23, 10:11

    SetupCommand.php:113 Reply

    Happy to change this if you have suggestions, but in another patch. For now i leave it as is because it is unrelated.
  16. Benni Mack voted on patch set 5 CR +1 06/23/23, 19:50

  17. Oliver Hader commented on patch set 5 CR -1 06/26/23, 13:07

    SetupCommand.php:113 Reply

    I don't think changing it to `VALUE_OPTIONAL` is required, is it?! * when called as `bin/typo3 setup [other args/opts]` → `admin-username` is already `admin` * when called as `bin/typo3 setup [other args/opts] --admin-username=myadmin` → a value is required "Options" in Symfony Console are always "optional" (sic!), the `InputOption::VALUE_RERQUIRED` means that a value must be provided in case the option is given. → using `bin/typo3 --admin-username --port` (no values given) seems to be wrong, but would work when using `InputOption::VALUE_OPTIONAL`

    SetupCommand.php:496

    Method `getFallbackValueEnvOrOption()` has an implicit check on whether an option was actually provided - and thus, prevents the fallback. Using plain `$input->getOption('admin-username')` would resolve `'admin'` (no need to fiddle around with the option configuration)... It might be something(!) like this (for `getFallbackValueEnvOrOption()`) - I didn't test it: ``` // use option value in case it was provided if ($input->hasParameterOption('--' . $option)) { return $input->getOption($option); } // use env-variable and fallback to option default // attention: the default value for options is `null`, not `false` return getenv($envVar) ?: $input->getOption($option); ```
  18. Jochen Roth rebased onto patch set 6 CR +1 V +1 07/03/23, 15:45

  19. Jochen Roth commented on patch set 6 07/03/23, 15:48

    SetupCommand.php:113 Reply

    Ack

    SetupCommand.php:496 Reply

    Ack
  20. core-ci voted on patch set 6 V +1 07/03/23, 15:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43257

  21. Oliver Hader voted on patch set 6 CR +1 07/05/23, 20:15

  22. Jochen Roth voted on patch set 6 V +1 CR +1 07/06/23, 08:47

  23. Markus Klein voted on patch set 6 V +1 CR +1 07/06/23, 18:11

  24. Benni Mack voted on patch set 6 V +2 CR +2 07/06/23, 18:22

  25. Benni Mack merged patch set 7 07/06/23, 18:22