Review main Merged

83179[TASK] Add FrontendTypoScriptFactory

Christian Kuhn CR +2 V +2 Expert +1021 −682 updated 03/19/24, 14:35

Commit message

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.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 4

Files 34

Show 14 more files