Issue Task Under Review

#111392Resolve the site of a site root page without loading its rootline

Alexander Schnitzler 11/10/26, 07:38 updated 11/10/26, 08:40

Description

Problem

SiteFinder::getSiteByPageId() loads the full rootline of the given page, even if the page itself is the root page of a site. The nearest site in the rootline of a site root is always the page itself, so the lookup is unnecessary.

This is expensive on installations with many sites: PageSlugCandidateProvider::getPagesFromDatabaseForCandidates() calls getSiteByPageId() for every candidate page, and each site root has the slug “/”. With a few hundred sites, a rootline is loaded for each of them on every frontend request.

SiteFinder::getSiteByPage() (added in #100378) still loads the rootline of the parent page for site roots below another page, e.g. nested sites.

Proposal

  • Return the site directly if the page is the root page of a valid site and neither a rootline nor a mount point parameter is given.
  • Skip the parent rootline in getSiteByPage() for site root pages.
  • Invalid sites, mount points and given rootlines keep their behaviour.

Note: a deleted page that is configured as site root is now resolved to its site, where RootlineUtility failed with a PageNotFoundException before.

Related to the large-site collection #93547 and #95690.

Reviews 1

History 35