IP anonymization task
Deprecated since version 14.0
The previous configuration method using
$GLOBALS
has been deprecated and will be removed in TYPO3 v15.
See also: Changelog Deprecation: #107562 - Ip Anonymization Task configuration via $GLOBALS
The IP Anonymization task can take a more elaborate configuration which is detailed below.
The task anonymizes the IP addresses to enforce the privacy of the persisted data.
Table of contents
Example: Configure additional tables for the "IP Anonymization" task
<?php
use TYPO3\CMS\Scheduler\Task\IpAnonymizationTask;
if (isset($GLOBALS['TCA']['tx_scheduler_task'])) {
$garbageCollectionTables =& $GLOBALS['TCA']['tx_scheduler_task']['types'][IpAnonymizationTask::class]['taskOptions']['tables'];
$garbageCollectionTables = array_replace($garbageCollectionTables ?? [], [
'tx_myextension_my_table' => [
'dateField' => 'tstamp',
'ipField' => 'private_ip',
],
]);
}
Warning
If your extension overrides the TCA of the scheduler extension, it must be loaded after typo3/cms-scheduler , otherwise the configuration might take no effect.
This entry configures that the field private_
of table
tx_
can be anonymized after a chosen number of days.
The field tstamp
will be taken into account to determine when the database
record was last changed.
Migration: Supporting custom tables for "IP Anonymization" tasks for both TYPO3 13 and 14
If your extension supports both TYPO3 13 (or below) and 14 keep the registration
of additional tables in the extensions ext_
until support
for TYPO3 13 is removed:
<?php
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Scheduler\Task\IpAnonymizationTask;
if ((new Typo3Version())->getMajorVersion() < 14) {
// TODO: Remove once TYPO3 13 support is dropped
// TYPO3 14 configuration can be found in Configuration/TCA/Overrides/tx_scheduler_ip_anonymization.php
$garbageCollectionTables =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][IpAnonymizationTask::class]['options']['tables'];
$garbageCollectionTables = array_replace($garbageCollectionTables ?? [], [
'tx_myextension_my_table' => [
'dateField' => 'tstamp',
'ipField' => 'private_ip',
],
]);
}