Review main Ready for review

86337[BUGFIX] Take `additional.php` into account for `setup` command

Stefan Bürk CR 0 V 0 Normal +177 −5 updated 11/10/26, 13:58

Commit message

The web based TYPO3 installer can make use of an existing
`additional.php` configuration file instead of asking for
global configuration like database connection credentials,
stored in either `typo3conf/` or `config` depending on
installation mode.

This file is used to allow quick setup for automatic instance
deployments and the local development environment tool `ddev`,
which provides and manages this file [1].

The `setup` command introduced with TYPO3 v12 ignores an
existing `additional.php` and requires providing database
credentials, failing in non-interactive mode if no driver
is given.

If neither `--driver` nor `TYPO3_DB_DRIVER` is given and the
default connection configured in `additional.php` is usable,
the `setup` command now uses it as-is. Only the driver
dependent defaults (charset, table options) are written to
`settings.php`, connection details stay in `additional.php`.

[1] https://github.com/ddev/ddev/pull/6525

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 14
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/37/86337/14 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/37/86337/14 && git cherry-pick FETCH_HEAD

Review

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

Merge conflicts 1

Issues 1

Files 3

Review log 2235

Show 710 earlier messages
  1. Stefan Bürk uploaded patch set 1 09/25/24, 13:04

  2. core-ci voted on patch set 1 V -1 09/25/24, 13:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/66585

  3. Garvin Hicking updated the commit message in patch set 2 V -1 09/25/24, 13:20

  4. core-ci voted on patch set 2 V -1 09/25/24, 13:25 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/66586

  5. Garvin Hicking commented on patch set 2 09/25/24, 13:27

    SetupCommand.php:376

    I think the array keys here need an explanation, like: Array index 0 (bool) indicates whether connection details shall be persisted to a config file. Array index 1 returns the array of credentials used for the connection Maybe we could use speaking array keys here like 'persisted' and 'credentials' or so? Or even a value object?

    SetupDatabaseService.php:195

    Can this have drawbacks or maintaining a positive-list of the keys? How could other keys get into the config here? Would that be a bad thing if maybe additional settings could be passed through? (honest question, this just reads as if it might have implications)
  6. Stefan Bürk commented on patch set 2 09/25/24, 14:56

    SetupCommand.php:376 Reply

    Had assoc keys first, but phpstan later complained about the `[$v1, $v2] = ...` expansion not getting it right. Will have a look again. At least will add some comments. However - that whole thing needs to be splitted up and rebuild on a more suitable structure, out of scope of this change. That is really only a bugfix to get it working without using the big hammer of a refactoring (which elimates a backport). And I would avoid introducing a new object here now (considering backport). Will have a look again, seems that the accesibility test has some issue now.

    SetupDatabaseService.php:195 Reply

    The end goal is to get rid of it again, but that needs a complete refactoring which is not reasonable for now. Only in case a fully etablished database connection using a existing `additional.php` remaining values are written to the `settings.php` without rewrite the full connection details in settings.php (like it would happen using the gui installer) - at least to some degree. Note that I have already pending changes which needs to adresse these settings anyway. For example adding the tableoptions/defaultTableOption in ConnectionPool which is currently not here - and only done by the installer/setup command for now. And that is the reason for this intermediate keeping them for now.
  7. Stefan Bürk uploaded patch set 3 V -1 09/25/24, 15:16

  8. core-ci voted on patch set 3 V +1 09/25/24, 15:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/66600

  9. Stefan Bürk uploaded patch set 4 V +1 09/25/24, 15:28

  10. Stefan Bürk commented on patch set 4 09/25/24, 15:30

    SetupCommand.php:376 Reply

    Done

    SetupDatabaseService.php:195 Reply

    Adding comments to it. Fine for you ? Note that this is a area needing further work, but needed for this bugfix to work in case of ddev and thus only a intermediate solution for a dedicated solving along with other solutions.
  1. core-ci voted on patch set 4 V +1 09/25/24, 15:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/66603

  2. Stefan Bürk uploaded patch set 5 V +1 09/25/24, 15:36

  3. Benjamin Franzke commented on patch set 4 09/25/24, 15:38

    We have just aligned WEB and CLI installer to (hopefully?) behave the same: > 81793: [BUGFIX] Create same configuration in web and cli install process | https://review.typo3.org/c/Packages/TYPO3.CMS/+/81793 I'm fine if there are still other placed that could need streamlining, but please let's not introduce differences between cli setup and web installer again. (or is the web installer already doing this and I get this totally wrong?)
  4. core-ci voted on patch set 5 V -1 09/25/24, 15:41 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/66604

  5. Stefan Bürk commented on patch set 5 09/25/24, 15:47

    Reply

    The web installer is completly skipping the database selection part if additional.php is provided (for example by ddev). CLI required to provide all db configuration options either by cli arguments or environment variables and completly ignoring (the already loaded) additional.configuration. Literally, the SetupDatabaseService is reading the values from the loaded globals in CLI mode but still asking and overriding it within the cli command. So no, it was not really "aligned" yet. Even more, the mentioned changed removed the `AdditionalConfiguration.php` -> `additional.php` silence upgrade and thus not getting them loaded in both installers (if renamed manually the difference is clear). Merged https://github.com/ddev/ddev/pull/6525 let ddev write the configuration file correctly (monorepo/legacy installation) and the difference can be seen.
  6. Stefan Bürk uploaded patch set 6 V -1 09/25/24, 15:50

  7. Stefan Bürk uploaded patch set 7 09/25/24, 15:56

  8. core-ci voted on patch set 6 V +1 09/25/24, 15:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/66607

  9. core-ci voted on patch set 7 V +1 09/25/24, 16:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/66609

  10. Garvin Hicking commented on patch set 7 09/25/24, 20:54

    SetupDatabaseService.php:195 Reply

    Yes, many thanks, much better for me. (resolving) I must admit the changes are not easy to judge for me and I would have to spend some time with it and really understand what's happening. Which I definitely want to do hopefully nexg week. If anyone else can approve it before, I wouldn't mind - I feel confident that it works as advertised by you ;) Maybe another approach could also be to make DDEV provide the TYPO3_DB_.... env constants so that the whole additional.php wouldn't need to be parsed in first place of the setup? That however would require yet another ddev patch, so that might be a way for v14's future...?
  11. Oliver Hader updated the commit message in patch set 8 V +1 10/18/24, 14:03

  12. André Buchmann commented on patch set 8 CR +1 V +1 05/08/25, 20:05

    Reply Unresolved

    Currently the CLI behaves differently than the WEB when there is a additional.php as Stefan described. Thx for streamlining both ways Stefan.
  13. Stefan Bürk uploaded patch set 9 CR +1 V +1 05/09/25, 11:38

  14. core-ci voted on patch set 9 V +1 05/09/25, 11:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78728

  15. André Buchmann voted on patch set 9 CR +1 V +1 05/09/25, 12:31

  16. Benni Mack updated the commit message in patch set 10 CR +1 V +1 04/22/26, 06:34

  17. core-ci voted on patch set 10 V -1 04/22/26, 07:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100738

  18. Stefan Bürk uploaded patch set 11 V -1 07/16/26, 15:41

  19. core-ci voted on patch set 11 V +1 07/16/26, 15:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104836

  20. Stefan Bürk rebased onto patch set 12 V +1 07/17/26, 13:50

  21. core-ci voted on patch set 12 V +1 07/17/26, 13:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104881

  22. Stefan Bürk rebased onto patch set 13 V +1 08/15/26, 23:24

  23. core-ci voted on patch set 13 V +1 08/15/26, 23:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106768

  24. Benni Mack uploaded patch set 14 V +1 11/10/26, 13:49

  25. core-ci voted on patch set 14 V +1 11/10/26, 13:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/113903