[6.x] Don't add per-site view paths when there's only one site - #15326
Closed
lazerg wants to merge 2 commits into
Closed
[6.x] Don't add per-site view paths when there's only one site#15326lazerg wants to merge 2 commits into
lazerg wants to merge 2 commits into
Conversation
Member
|
Fixed in #15325 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
AddViewPathsmiddleware prefixes every view path and namespace hint with a/<site>sibling directory so a multi-site install can override templates per site. It does that on every front-end request, whether or not the install actually has more than one site.On a single-site install those directories don't exist, so every prefixed entry is a guaranteed miss and the finder probes twice as many paths as it needs to. It's much worse on hosts that set
open_basedir, since PHP can't cache a negative realpath lookup and each miss re-walks the whole path on every call. Counting the finder'sfile_exists()calls on a single-site install, a lookup went from 56 probes to 28 with the render unchanged.This skips the middleware when there's only one site. Worth flagging: anyone on a one-site install who kept templates in
resources/views/<site>would need to move them up a level. The issue also suggests filtering onis_dir()instead, which would help multi-site installs too, but that stats every path on every request, so I've kept this to the case that was reported.Fixes #15323