Feature: #107289 - Automatic history tracking for Extbase entities
See forge#107289
Description
TYPO3 now tracks the history of all Extbase domain entities by
listening to Extbase persistence events and storing them in the
sys_ table. This provides a comprehensive audit trail for
all frontend and backend operations on Extbase entities without requiring
any code changes.
The feature leverages TYPO3's existing
\Record
infrastructure and integrates seamlessly with the backend record history
functionality.
The history tracking captures:
- Create operations: when entities are persisted for the first time
- Update operations: when existing entities are modified
- Delete operations: when entities are removed from persistence
All operations are tracked with their proper user context (frontend users, backend users, anonymous operations) and include full entity data snapshots.
Configuration
History tracking is disabled by default. It can be enabled with the
feature toggle extbase. (available via
System > Settings > Feature toggles).
Once the feature toggle is enabled, history tracking is active for all Extbase domain model storage tables. It can then be disabled via TCA on a per-table basis:
<?php
declare(strict_types=1);
return [
'ctrl' => [
'title' => 'my_extension.messages:my_title',
'label' => 'uid',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'delete' => 'deleted',
// ...
'extbase' => [
'enableHistoryTracking' => false,
],
],
'columns' => [
// ...
],
];
Defining this at the TCA level (instead of TypoScript persistence
configuration) means that it can be configured per table and
evaluated consistently in all contexts (backend, frontend, CLI).
If a third-party extension enables history tracking via TCA, it can be
disabled using TCA overrides. Disabling the feature toggle also disables
all history tracking, even for tables configured with
enable.
In addition, the following PSR-14 event listeners can be deregistered or replaced at instance level:
extbase-history- tracker- persisted extbase-history- tracker- updated extbase-history- tracker- removed
Note
Enabling history tracking can generate a large number of history entries for Extbase entities. These entries are mixed with regular editorial changes made in the TYPO3 backend (FormEngine).
Important
All changes to Extbase entity data are logged, including full initial data snapshots. This may have implications for GDPR / DSGVO and other security-related data handling requirements. Data may need to be pruned regularly. It is advisable to disable history tracking for tables containing sensitive data. For this reason, the feature toggle is disabled by default and requires explicit activation.
Impact
Changes to all Extbase domain entities can now be tracked
in the
sys_ table, making them visible in the
backend record history. This requires enabling the feature toggle
extbase. (default: false).
This feature provides administrators and developers with full visibility into data changes without requiring interface implementations or code modifications.
Technical details
The implementation consists of a PSR-14 event listener
Extbase
which automatically registers for the following Extbase persistence
events:
EntityAdded To Persistence Event EntityUpdated In Persistence Event EntityRemoved From Persistence Event
All entities with valid TCA configuration are tracked automatically. This uses the Extbase DataMap API, TCA Schema API, and RecordHistoryStore API.