CLI command

Target group: Integrators

A console command is provided by the ext_lowlevel:Index system extension. It permanently deletes records from the database. Options can be added to the command as below.

The command can be executed on the console:

# Remove all deleted records
vendor/bin/typo3 cleanup:deletedrecords
Copied!
# Remove all deleted records
typo3/sysext/core/bin/typo3 cleanup:deletedrecords
Copied!

It provides the following options:

--depth
Shortcut

-d

Type

integer

Default

1000

Sets the traversal depth. 0 (zero) will only analyze the start page (see --pid), 1 will traverse one level of subpages, etc.

Example
# Remove all deleted records, starting from the page tree root
# with a maximum level of 3
vendor/bin/typo3 cleanup:deletedrecords --depth=3
vendor/bin/typo3 cleanup:deletedrecords -d=3
Copied!
# Remove all deleted records, starting from the page tree root
# with a maximum level of 3
typo3/sysext/core/bin/typo3 cleanup:deletedrecords --depth=3
typo3/sysext/core/bin/typo3 cleanup:deletedrecords -d=3
Copied!
--dry-run
Default

null

If this option is set the records will not actually be deleted but records which would be deleted are shown.

Example
vendor/bin/typo3 cleanup:deletedrecords --dry-run
Copied!
typo3/sysext/core/bin/typo3 cleanup:deletedrecords --dry-run
Copied!
--min-age

New in version 12.3

Shortcut

-m

Type

integer

Default

0

The minimum age in days records need to be marked for deletion before actually removing them.

Example
# Remove all deleted records older than 90 days
vendor/bin/typo3 cleanup:deletedrecords --min-age=90
vendor/bin/typo3 cleanup:deletedrecords -m=90
Copied!
# Remove all deleted records older than 90 days
typo3/sysext/core/bin/typo3 cleanup:deletedrecords --min-age=90
typo3/sysext/core/bin/typo3 cleanup:deletedrecords -m=90
Copied!
--pid
Shortcut

-p

Type

integer

Default

0 (page tree root)

Sets the start page in the page tree.

Example
# Remove all deleted records from the page with UID 42
vendor/bin/typo3 cleanup:deletedrecords --pid=42
vendor/bin/typo3 cleanup:deletedrecords -p=42
Copied!
# Remove all deleted records from the page with UID 42
typo3/sysext/core/bin/typo3 cleanup:deletedrecords --pid=42
typo3/sysext/core/bin/typo3 cleanup:deletedrecords -p=42
Copied!