Breaking: #111263 - Removed cache clearing hooks of DataHandler
See forge#111263
Description
The cache flushing logic of
\TYPO3\
has been moved to
\TYPO3\, see
Feature: #111263 - Flush caches without DataHandler. The following hooks have been removed in
favor of PSR-14 events:
$GLOBALS['TYPO3_ CONF_ VARS'] ['SC_ OPTIONS'] ['t3lib/ class. t3lib_ tcemain. php'] ['clear Page Cache Eval'] $GLOBALS['TYPO3_ CONF_ VARS'] ['SC_ OPTIONS'] ['t3lib/ class. t3lib_ tcemain. php'] ['clear Cache Post Proc']
The protected methods
prepare and
get of
Data have been removed. Its
constructor receives
Cache
and
Cache instead of
\TYPO3\ and
\TYPO3\.
Flushing the "pages" cache group or all caches in the backend, for example
via the cache toolbar or Page TSconfig
TCEMAIN.,
now dispatches
\TYPO3\, like the
cache: command. Flushing all caches flushes every cache group,
including the default group of caches configured without
groups
.
Caches configured with an empty list of groups, such as the runtime cache,
are flushed directly, as before.
Impact
Hook implementations registered under
clear or
clear are no longer executed.
Affected installations
Installations with extensions registering one of the hooks are affected. The extension scanner reports their usage as a strong match.
Migration
Implementations of
clear, and implementations of
clear that changed the cache tags or commands of a record,
become listeners of
\TYPO3\:
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Cache\Event\BeforeRecordRelatedCachesAreFlushedEvent;
final readonly class FlushNewsListPage
{
#[AsEventListener('my-extension/flush-news-list-page')]
public function __invoke(BeforeRecordRelatedCachesAreFlushedEvent $event): void
{
if ($event->table === 'tx_news_domain_model_news') {
$event->addPageId(42);
}
}
}
Implementations that reacted to a cache command or flushed further caches
become listeners of
\TYPO3\,
whose plan holds the requested records and commands and accepts further cache
tags and groups. Follow-up work such as purging a reverse proxy belongs into a
listener of
\TYPO3\.
Implementations that read the data map, command map or history records of the
passed
Data should use the
DataHandler hooks
process and
process instead.