#111741 Clean up stored form submissions and their uploaded files
Description
Since #111734 the StoreSubmission finisher stores form submissions in the table form_submission, and #111735 lists them in the backend module “Forms > Submissions”. The lifetime of this data is not handled yet. Personal data is kept forever unless an editor deletes it by hand, and uploaded files outlive their submission or vanish before it.
1. Retention period
A new finisher option retentionPeriod sets the number of days after which a submission expires. 0, the default, keeps the submission until it is deleted. The expiry date is stored in the new column form_submission.expires and shown in the detail view of the module. The option can be set in the form editor.
2. Cleanup command
The new console command form:cleanup:submissions deletes all submissions whose expiry date has passed, including their uploaded files. It can be run in the scheduler, and —dry-run lists what would be deleted.
3. Delete uploaded files with their submission
Deleting a submission, in the module, the list module or by the command, removes only the file references today. The uploaded files and their upload folder stay in the storage. The files of a submission are now deleted with it, unless another record still references them.
4. Keep files of stored submissions in form:cleanup:uploads
form:cleanup:uploads removes upload folders by age alone. The files of a stored submission are therefore deleted after two weeks by default, while the submission still points to them. The command now skips upload folders that contain a file referenced by a submission.
Reviews 1
History 01
-
Gerrit Code Review pushed patch set 1 for main to change 98366 status
NewUnder Review 12/05/26, 15:06