Project

General

Profile

Actions

Feature #93174

closed

Command list unavailable, when command creation with container fails

Added by Helmut Hummel almost 4 years ago. Updated over 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 #1

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

Actions #2

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

Actions #3

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

Actions #4

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

Actions #5

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

Actions #6

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

Actions #7

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

Actions #8

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

Actions #9

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

Actions #10

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

Actions #11

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
Actions #12

Updated by Benjamin Franzke almost 4 years ago

  • Tracker changed from Bug to Feature
  • TYPO3 Version deleted (10)
Actions #13

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

Actions #14

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

Actions #15

Updated by Benjamin Franzke almost 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #16

Updated by Benni Mack over 3 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF