TYPO3 v15 dev-main snapshot ()

This commit is contained in:
2026-08-10 22:31:38 +02:00
commit 4392dbe2ce
142 changed files with 11824 additions and 0 deletions
@@ -0,0 +1,94 @@
:navigation-title: Table Garbage Collection
.. include:: /Includes.rst.txt
.. _table-garbage-collection-task:
=============================
Table garbage collection task
=============================
The table garbage collection task can take a more elaborate
configuration which is detailed below.
.. contents:: Table of contents
.. _table-garbage-collection-task-usage:
Using the garbage collection task
=================================
The task can be registered to clean up a particular table, in which
case you simply choose the table and the minimum age of the records to
delete from the task configuration screen.
.. figure:: /Images/TableGarbageCollectionTaskConfiguration.png
:alt: Table Garbage Collection task configuration
Configuring the table garbage collection task
In case no minimum age is choosen, the configured :php:`expirePeriod` is used.
.. figure:: /Images/TableGarbageCollectionTaskConfiguration-2.png
:alt: Table Garbage Collection task configuration default expire period
Configuring the table garbage collection task with default expire period
It is also possible to clean up all configured table by
checking the "Clean all available tables" box.
The configuration for
the tables to clean up is stored in the TCA of table `tx_scheduler_task`, in
field `tables`.
This configuration is an array with the table names as fields and the following
entries:
- option :php:`expireField` can be used to point to a table field
containing an expiry timestamp. This timestamp will then be used to
decide whether a record has expired or not. If its timestamp is in the
past, the record will be deleted.
- if a table has no expiry field, one can use a combination of a date
field and an expiry period to decide which records should be deleted.
The corresponding options are :php:`dateField` and :php:`expirePeriod`.
The expiry period is expressed in days.
.. _table-garbage-collection-task-example:
Example: Configure additional tables for the "Garbage Collection" task
======================================================================
.. deprecated:: 14.0
The previous configuration method using
:php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables']`
has been deprecated and will be removed in TYPO3 v15.
See also: `Changelog Deprecation: #107550 - Table Garbage Collection Task configuration via $GLOBALS <https://docs.typo3.org/permalink/changelog:deprecation-107550-1736193200>`_
.. literalinclude:: _codesnippets/_tx_scheduler_garbage_collection.php.inc
:language: php
:caption: packages/my_extension/Configuration/TCA/Overrides/tx_scheduler_garbage_collection.php
.. include:: /_Includes/_ExtendingSchedulerTca.rst.txt
The first part of the configuration indicates that records older than
180 days should be removed from table :code:`tx_myextension_my_table` ,
based on the timestamp field called "tstamp". The second part
indicates that old records should be removed from table
:code:`tx_myextension_my_other_table` directly based on the field `expire`
which contains expiration dates for each record.
.. _table-garbage-collection-task-migration:
Migration: Supporting custom tables for garbage collection 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 :file:`ext_localconf.php` until support
for TYPO3 13 is removed:
.. literalinclude:: _codesnippets/_additional.php.inc
:language: php
:caption: packages/my_extension/ext_localconf.php
+42
View File
@@ -0,0 +1,42 @@
:navigation-title: Basic tasks
.. include:: /Includes.rst.txt
.. _base-tasks:
==========================================
The basic tasks provided by the TYPO3 Core
==========================================
The Scheduler comes by default with several tasks:
- **Caching framework garbage collection** : some cache backends do not
have an automatic garbage collection process. For these it is useful
to run this Scheduler task to regularly free some space.
- **Fileadmin garbage collection** : empties :file:`_recycler_` folders in
the fileadmin.
- **Table garbage collection** : cleans up old records from any table in
the database. See related section below for more information on
configuration.
Most TYPO3 console command can also be executed via scheduler.
The following tasks provide configuration options that need dedicated chapters:
.. toctree::
:glob:
:titlesonly:
*
.. _other-tasks:
Providing custom tasks from your extension
==========================================
More tasks are provided by system extensions, such as the Extension
Manager, which defines one for updating the available extensions list.
The base tasks are also there to serve as examples for task developers
(see :ref:`developer-guide`).
@@ -0,0 +1,53 @@
:navigation-title: IP Anonymization task
.. include:: /Includes.rst.txt
.. _ip-anonymization-task:
=====================
IP anonymization task
=====================
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.
.. contents:: Table of contents
.. _ip-anonymization-task-example:
Example: Configure additional tables for the "IP Anonymization" task
====================================================================
.. deprecated:: 14.0
The previous configuration method using
:php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\IpAnonymizationTask::class]['options']['tables']`
has been deprecated and will be removed in TYPO3 v15.
See also: `Changelog Deprecation: #107562 - Ip Anonymization Task configuration via $GLOBALS <https://docs.typo3.org/permalink/changelog:deprecation-107562-1736193200>`_
.. literalinclude:: _codesnippets/_tx_scheduler_ip_anonymization.php.inc
:language: php
:caption: packages/my_extension/Configuration/TCA/Overrides/tx_scheduler_ip_anonymization.php
.. include:: /_Includes/_ExtendingSchedulerTca.rst.txt
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.
.. _ip-anonymization-task-migration:
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 :file:`ext_localconf.php` until support
for TYPO3 13 is removed:
.. literalinclude:: _codesnippets/_ext_localconf_ip_anonymization.php.inc
:language: php
:caption: packages/my_extension/ext_localconf.php
@@ -0,0 +1,16 @@
<?php
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask;
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_garbage_collection.php
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][TableGarbageCollectionTask::class]['options']['tables']['tx_myextension_errorlog'] = [
'dateField' => 'tstamp',
'expirePeriod' => '180',
];
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][TableGarbageCollectionTask::class]['options']['tables']['tx_myextension_uniqalias'] = [
'expireField' => 'expire',
];
}
@@ -0,0 +1,17 @@
<?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',
],
]);
}
@@ -0,0 +1,17 @@
<?php
use TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask;
if (isset($GLOBALS['TCA']['tx_scheduler_task'])) {
$garbageCollectionTables =& $GLOBALS['TCA']['tx_scheduler_task']['types'][TableGarbageCollectionTask::class]['taskOptions']['tables'];
$garbageCollectionTables = array_replace($garbageCollectionTables ?? [], [
'tx_myextension_my_table' => [
'dateField' => 'tstamp',
'expirePeriod' => 180,
],
'tx_myextension_my_other_table' => [
'expireField' => 'expire',
],
]);
}
@@ -0,0 +1,14 @@
<?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',
],
]);
}