Skip to content
Snippets Groups Projects
Commit 5712a422 authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[TASK] Add FrontendTypoScriptFactory

In version 12, the introduction of the new TypoScript parser
was accompanied by the implementation of factories for
PageTsConfig and UserTsConfig.
A factory for Frontend TypoScript has not been added,
though: Frontend TypoScript creation ended up in
TSFE->getFromCache(). At this point, establishing a proper
factory was unfeasible due to the numerous dependencies of
TypoScript creation to TSFE internals.

With recent refactorings around TSFE, coupled with lots of
state now being represented as request attributes, it's now
possible to decompose getFromCache() and establish a
FrontendTypoScriptFactory.

getFromCache() is a complex beast: It influences Frontend
rendering performance a lot, and tries to trigger the least
amount of calculations, especially in 'fully cached pages'
context. This results in high required complexity due to
lots of state with diverse cross dependencies.

The method composes of three main steps:
1. Bootstrap TypoScript setting ("constants") and calculate
   setup condition verdicts. This creates required TypoScript
   related state needed to calculate the page cache identifier.
2. Access page cache, lock page rendering if needed, and see
   if a possible page cache content contains uncached ("_INT")
   sections.
3. Calculate at least setup "config." depending on given
   type/typeNum, but create full TypoScript setup if a cached
   page contains uncached sections or could not be retrieved
   from cache.

The patch extracts parts 1 and 3 to FrontendTypoScriptFactory.
Part 2 is moved into PrepareTypoScriptFrontendRendering
middleware.

This approach allowed these related refactorings:
* The release of rendering locks is now consolidated within the
  PrepareTypoScriptFrontendRendering middleware. This guarantees
  locks are released, even in scenarios where lower middleware
  components encounter errors. This addresses an issue where
  locks retained during crashes, leading to deadlock situations
  in subsequent requests.
* Dependencies to TSFE within ext:redirects RedirectService
  are reduced, and it no longer locks page rendering.
* The Extbase BackendConfigurationManager utilizes the new
  factory, eliminating the need for its own implementation.

The patch unlocks further refactorings: It especially allows
removing the cache related properties from TSFE by representing
them as request attributes. Subsequent patches will address this
task accordingly.

Resolves: #103410
Related: #97816
Related: #98914
Related: #102932
Releases: main
Change-Id: I7fd158cffeebe6b2c64e0e3595284b8780fb73cf
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83179


Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarGarvin Hicking <gh@faktor-e.de>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarGarvin Hicking <gh@faktor-e.de>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 5ebc2e3f
Branches
Tags
No related merge requests found
Showing
with 671 additions and 606 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment