[TASK] Stateless SiteFinder
The SiteFinder is an often injected service, but its stateful due to cache properties and suffers from improper cache eviction when SiteWriter changes site configuration. Note the overall class construct / separation of SiteConfiguration, SiteFinder and some related classes is a bit unfortunate and naming is not perfect. We may want to review these constructs in v14 again. * Avoid sites property altogether since it is a 1:1 call of SiteConfiguration->getAllExistingSites(), which has its own cache. * Declare readonly. * Use runtimeCache for "root id to identifier mapping", get runtimeCache injected. * Avoid loading all sites within __construct()! Do this on demand instead. * Listen on SiteConfigurationChangedEvent (by SiteWriter) to remove the runtime cache for automatic cache eviction on site changes. * Adapt some test cases. Resolves: #105264 Related: #105263 Releases: main Change-Id: Idea0f3d487b32a6b552f77ac52c539d6c793cd35 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/86548 Tested-by:core-ci <typo3@b13.com> Tested-by:
Oliver Bartsch <bo@cedev.de> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Oliver Bartsch <bo@cedev.de> Tested-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Stefan Bürk <stefan@buerk.tech>
Showing
- typo3/sysext/core/Classes/Site/SiteFinder.php 41 additions, 37 deletionstypo3/sysext/core/Classes/Site/SiteFinder.php
- typo3/sysext/core/Tests/Unit/Routing/SiteMatcherTest.php 8 additions, 16 deletionstypo3/sysext/core/Tests/Unit/Routing/SiteMatcherTest.php
- typo3/sysext/core/Tests/Unit/Site/Entity/SiteTest.php 8 additions, 48 deletionstypo3/sysext/core/Tests/Unit/Site/Entity/SiteTest.php
- typo3/sysext/frontend/Tests/Unit/Middleware/SiteResolverTest.php 8 additions, 16 deletions...ysext/frontend/Tests/Unit/Middleware/SiteResolverTest.php
- typo3/sysext/redirects/Tests/Functional/EventListener/AddPlainSlugReplacementSourceTest.php 3 additions, 3 deletions...ional/EventListener/AddPlainSlugReplacementSourceTest.php
Please register or sign in to comment