mfd / delete-hidden
Soft-deletes hidden tt_content records older than N days, including recursive b13/container children.
Package info
github.com/marketing-factory/delete_hidden
Type:typo3-cms-extension
pkg:composer/mfd/delete-hidden
Requires
- typo3/cms-core: ^13.4
Requires (Dev)
- phpstan/phpstan: ^2.0
- squizlabs/php_codesniffer: ^3.0
- typo3/testing-framework: ^9.3
Suggests
- b13/container: Required for ancestor-chain container traversal in host projects using b13/container
README
TYPO3 extension (v13.4+) that soft-deletes hidden tt_content records older than a configurable number of days, including their recursive b13/container children.
How it works
- FinderService queries
tt_contentfor records wherehidden = 1,t3ver_wsid = 0, andtstampis older than the given threshold. Pages withtx_delete_hidden_exclude = 1are skipped. - CleanupService enforces a safety cap (default 500) and delegates all deletions to TYPO3's
DataHandler— no direct SQL. AnyDataHandlererror aborts the run immediately. - CleanupCommand exposes the service as a Symfony Console command.
CLI usage
# Preview candidates without deleting (dry run) typo3 delete_hidden:cleanup --days=90 --dry-run # Delete hidden content older than 30 days typo3 delete_hidden:cleanup --days=30 # Scope to a specific page subtree typo3 delete_hidden:cleanup --days=90 --page=42 # Override the default safety cap of 500 typo3 delete_hidden:cleanup --days=90 --limit=1000 # Verbose output — shows a table of deleted records typo3 delete_hidden:cleanup --days=90 -v
Options
| Option | Default | Description |
|---|---|---|
--days |
90 |
Minimum age in days for a record to be a candidate |
--dry-run |
— | List candidates without performing any deletions |
--page |
0 (all pages) |
Restrict to a page subtree by UID |
--limit |
500 |
Safety cap — aborts before any deletion when exceeded |
Exit codes
| Code | Meaning |
|---|---|
0 |
Success |
1 |
Validation error, safety cap exceeded, or DataHandler error |
Page exclusion
Set tx_delete_hidden_exclude = 1 on a page to exclude all its content from cleanup.
Installation
composer require marketing-factory/delete-hidden
Then activate the extension in the TYPO3 backend under Admin Tools > Extensions or via CLI:
typo3 extension:activate delete_hidden
Scheduler task
The extension registers a TYPO3 Scheduler task named "Delete Hidden Content Elements".
- Navigate to System > Scheduler in the TYPO3 backend
- Add a new task and select Delete Hidden Content Elements from the class dropdown
- Configure the fields:
- Days — minimum age in days for a record to be a candidate (default: 90)
- Limit — maximum records per run (default: 500)
- Set frequency and save
The Scheduler task always executes (no dry-run mode). If the candidate count exceeds the limit, only the first N records are processed; the rest are handled in subsequent runs.
Running tests
Tests require the project's Composer dependencies to be installed (the vendor/ directory at the repository root).
# From the repository root — run all unit tests for this extension
phpunit -c extensions/delete_hidden/Tests/Build/UnitTests.xml
# From the repository root — run all functional tests for this extension (requires running MySQL database via ddev)
phpunit -c extensions/delete_hidden/Tests/Build/FunctionalTests.xml
Test files are located in Tests/Unit/ and Tests/Functional/.
Requirements
- TYPO3 13.4+
- PHP 8.2+
- b13/container (optional) — required only if the host project uses container elements