Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Decouple Bootstrap and Application engaging a PSR-11 container
In order to avoid global state and to support full-application subrequests (later on), bootstraping, application initialization and application execution needs to be decoupled. (To be able to initialize a frontend Application in backend Application context, the frontend Application may not re-execute bootstraping code.) That means from now on: * Bootstrap is limited to stateless bootstrapping => setting up package manager and configuration * A (new) Container (PSR-11) performs class initialization => e.g. `new Frontend/Http/Application()` * Application performs execution => checking possible (application specific) redirects => offloading work to the request handler This commit transforms Bootstrap into a (static) bootstrap utility that returns a container (minimal, static PSR-11 implementation). The entry-point scripts execute the bootstraper and use the returned container to initialize and run the application. This commit acts as a starting point for a broader PSR-11 container support in TYPO3. We do – on purpose – use an own, very limited, anonymous and static there is no configuration) PSR-11 implemententation for now. This interim container implementation will be replaced by whatever PSR-11 supporting container solution we use later on. That keeps the necessary Bootstrap refactoring seperate from the introduction of a full dependency injection container implementation. All existing bootstrap methods keep working as before but the non-static method invocation should be deprecated at some point. typo3/cms-cli is adapted for the changed entry point script with: TYPO3/cms-cli#1 typo3/testing-framework is adapted in TYPO3/testing-framework#55 This patch brings one important behavioral change: The install tool redirect (if essential configuration is missing) is perfomed during application execution – after the configuration has been loaded (falling back to failsafe mode if missing) – now. Previously the application performed the redirect before it would call Bootstraps configure() method. Now that the Application is decoupled from bootstrap, the bootstrapper ensures it can always create an Application class, in order for the application to be in charge of the decision what should happen if essential configuration is missing. Dependency changes: composer require psr/container:^1.0 composer require typo3/cms-cli:^2.0 composer require typo3/testing-framework:^3.2 --dev Change-Id: Idc59665dfcf7250a8a42b3d908a5a2376067700c Releases: master Resolves: #83951 Reviewed-on: https://review.typo3.org/55773 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Benni Mack <benni@typo3.org> Tested-by: Benni Mack <benni@typo3.org>
- Loading branch information