Add RemoveOldAuditCronJob to clean up outdated audit trails

- Introduced `RemoveOldAuditCronJob` class implementing `CronJobInterface` to delete old audit trails based on configured retention period.
- Added `deleteBefore` method to `AuditTrailRepository` to handle removal of records older than the specified date.
- Created `RemoveOldAuditCronJobTest` to ensure correct functionality for job execution and canRun logic.
- Updated DI configuration to include the `delete_after` parameter for audit trail retention settings.
This commit is contained in:
2026-02-17 12:04:22 +01:00
parent ceb58de858
commit b89911e307
5 changed files with 147 additions and 0 deletions

View File

@@ -325,6 +325,12 @@ class Configuration implements ConfigurationInterface
->end()
->end();
$rootNode->children()
->arrayNode('audit_trail')->addDefaultsIfNotSet()->children()
->scalarNode('delete_after')->cannotBeEmpty()->defaultValue('P6M')->info('The duration (a valid interval) before deleting the audit trail. Will be run by a cronjob.')->end()
->end()
->end();
return $treeBuilder;
}
}