Review main Merged

97274[TASK] Resolve page ancestry in the backend with one query

Benni Mack CR +2 V +2 Hard +671 −37 updated 11/01/26, 19:25

Commit message

BackendUtility::BEgetRootLine() executes one query per page level,
plus workspace overlay queries per level in a workspace. Callers
like BackendUserAuthentication::isInWebMount(), used by most
permission checks, walk the same rootline several times per
request, as the runtime cache is keyed by the given where clause.

The new PageAncestryResolver resolves the ancestry of a page in a
workspace with one recursive CTE query via PageAncestryRepository.
The resulting PageAncestry is ordered from the page to the root
level, creates Page objects lazily and provides the permission
settings of the live pages. As with BEgetRootLine(), pages deleted
in the workspace stay part of the ancestry, and a broken or
circular page tree results in an incomplete ancestry instead of an
exception. RecordFactory is injected lazily, as it is not needed
for permission checks.

The following callers are migrated:

* BackendUserAuthentication::isInWebMount(), when called with the
  default permission clause and no getPagePermsClause hook is
  registered
* BackendUtility::getPagesTSconfig()
* IncludeTreeConditionMatcherVisitor
* SlugHelper::resolveParentPageRecord()
* DatabasePageRootline

For a page on level seven, isInWebMount() now needs 2 instead of 8
queries in live and 3 instead of 12 queries in a workspace.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 3

Files 12

Review log 56

  1. Benni Mack uploaded patch set 1 11/01/26, 10:18

  2. core-ci voted on patch set 1 V +1 11/01/26, 10:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112999

  3. Georg Ringer voted on patch set 1 CR +1 V +1 11/01/26, 11:05

  4. Stefan Bürk voted on patch set 1 CR +1 V +1 11/01/26, 15:03

  5. Benni Mack commented on patch set 1 CR +2 V +2 11/01/26, 19:25

    thanks, guys!
  6. Benni Mack merged patch set 2 11/01/26, 19:25