The TypoScript editing module "Template" currently has different
cache flush behaviours, depending on *how* the data is being modified:
a) The DataHandler cache command 'all' is triggered when a TypoScript
constant is changed via the ObjectBrowser or ConstantEditor
controllers and when a new sys_template record is created.
b) Tag-based cache clearing in group 'pages' is performed by the
DataHandler when a TypoScript template is edited via
"Edit the whole template record" button.
Note: This is because the edit functionality is using
the plain record_edit FromEngine controller which means
EXT:tstemplate controllers only act as proxy here.
Note that both cases are wrong for sys_template records:
* Case a) flushes too many caches:
The DataHandler cache command 'all' flushes TCA, ext_localconf and
Dependency Injection caches – since #75581 even opcache caches.
All these (performance relevant) caches are never influenced by
TypoScript and must not be flushed in production systems
(results in slow responses due to cache rebuilds).
* Case b) flushes too few caches:
A sys_template record influences (in 99.9% cases) the page tree.
By flushing the record via DataHandler tag flushed there
are two caches being flushed:
* pageId_[pidOfSysTemplateRecord]
* sys_template_[uidOfSysTemplateRecord]
* sys_template
Non of these tags are assigned to page caches that rely on this
sys_template record.
There are two options to consolidate cache clearing:
* Use DataHandler tag-based flushing as in case b).
The drawback: generates *a lot* of cache tags which
are then flushed very rarely.
* Flush the 'pages' cache group in both cases. This variant
flushes a bit too much (of course, tags are more precise),
as pages which did not rely on a currently modified
sys_template record are flushed as well.
This change implements the latter option as we think the drawbacks of
flushing a bit too much is better than the drawback of generating a
ton of cache tags.
As all cases where the cache command 'all' was used, already modify
sys_template though DataHandler processing, we can remove the previous
cache commands and move the flush logic for all cases into a hook that
is triggered by the DataHandler when records are being created/changed.