Project

General

Profile

Actions

Feature #93174

closed

Command list unavailable, when command creation with container fails

Added by Helmut Hummel over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
CLI
Target version:
-
Start date:
2020-12-27
Due date:
% Done:

100%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

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)
  • ...

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #93425: Adapt for upcoming Symfony 5.3 console.command DI properties: description and hiddenClosedBenjamin Franzke2021-02-03

Actions
Actions

Also available in: Atom PDF