IP anonymization task 

Deprecated since version 14.0

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.

Example: Configure additional tables for the "IP Anonymization" task 

packages/my_extension/Configuration/TCA/Overrides/tx_scheduler_ip_anonymization.php
<?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',
        ],
    ]);
}
Copied!

This entry configures that the field private_ip of table tx_myextension_my_table 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_localconf.php until support for TYPO3 13 is removed:

packages/my_extension/ext_localconf.php
<?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',
        ],
    ]);
}
Copied!