Feature #93174
closedCommand list unavailable, when command creation with container fails
100%
Description
The following scenario can be verified with TYPO3 11:
- Have a fully functional TYPO3
- Rename the db name in LocalConfiguration.php to a non existing one
- call bin/typo3
Reason for the failure is, that creation of extension:activate command object requires a working DB connection,
because its dependency InstallUtility needs one on object creation.
While certainly InstallUtility is a major culprit, because its many dependencies, several questions arise with this issue.
1. What is the expected (global) state on command object creation?
- is it valid to access TYPO3_CONF_VARS in constructor?
- is it valid to access database in constructor?
- is it valid to access TCA in constructor?
- is it valid to access ... in constructor?
Currently the boot state in constructor is different from TYPO3 install state, for commands registered via ServiceProvider.
When enssential config files exist, TYPO3 will be fully booted, otherwise only failsafe boot is preformed.
2. What is expected behaviour of the CLI tool, when object creation of one command object fails?
- fail the entire CLI (like it is now)?
- ignore the command that fails?
- ignore the command that fails, but show warning?
Depending on how we answer 1., we could define that object creation must never fail, thus object creation must never
depend on global state. In any case, the decision must be made and be documented
3. What is the expectation for the command list
- all registered commands should always be shown
- only commands should be shown that can be executed (depending on whether TYPO3 is set up or not)
- ...
Updated by Gerrit Code Review almost 4 years ago
- Status changed from New to Under Review
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67241
Updated by Gerrit Code Review almost 4 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67241
Updated by Gerrit Code Review almost 4 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67241
Updated by Helmut Hummel almost 4 years ago
Proposal in https://review.typo3.org/67241:
Low level commands… * will only be defined by TYPO3 core, not by third party extensions or libraries (despite by using internal interfaces) * will not use any $GLOBALS in constructor * will only inject dependencies defined by service providers * must not require a database connection during construction * will only be defined in internal service providers * may use the internal BootService to bootstrap to a certain boot level Regular commands… * are allowed to access TYPO3_CONF_VARS in constructor * are allowed to inject any service via constructor * are allowed to access TCA in constructor * SHOULD avoid database calls in constructor (and services that require the database during construction), otherwise they may break `bin/typo3 list` when database has not been configured. * may fail during construction, e.g. because of a stale DI container (an upcoming low level cache:flush/warmup command will be provided for such scenarios) The command list `bin/typo3 list`… * will show all low level commands, when TYPO3 has not yet been configured * will show all low level and regular commands, once TYPO3 has been configured The upgrade command therefore now runs fully uncached and does not require a full boot upfront. The extension:(de)activate and scheduler:run commands are adapted to use low level features in combination with lazy loading, in order to avoid database calls during construction (which interferes with bin/typo3 list|help when).
Updated by Gerrit Code Review almost 4 years ago
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67521
Updated by Gerrit Code Review almost 4 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67521
Updated by Gerrit Code Review almost 4 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67521
Updated by Gerrit Code Review almost 4 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67241
Updated by Gerrit Code Review almost 4 years ago
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67635
Updated by Gerrit Code Review almost 4 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67635
Updated by Benjamin Franzke almost 4 years ago
- Related to Task #93425: Adapt for upcoming Symfony 5.3 console.command DI properties: description and hidden added
Updated by Benjamin Franzke almost 4 years ago
- Tracker changed from Bug to Feature
- TYPO3 Version deleted (
10)
Updated by Gerrit Code Review almost 4 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67635
Updated by Gerrit Code Review almost 4 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67635
Updated by Benjamin Franzke almost 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 38121e3441643397ba1f990b0edd1e7d74f87f27.