|
|
|
**note : this is a work in progress. No expiration is yet implemented on Framaforms, causing large database management problems. .**
|
|
|
|
|
|
|
|
The webforms and their submissions should be automatically deleted under 6 months in the PostgreSQL database if no user action is taken.
|
|
|
|
The user should be notified 2 weeks in advance of their webform submission, and a link should enable them to give 6 more months of lifetime to their webform.
|
|
|
|
|
|
|
|
## SQL QUERY
|
|
|
|
** the following queries can be executed through a hook on webform access by a user, or on the Drupal hook_cron. The queries should be executed once a day.**
|
|
|
|
|
|
|
|
#### DELETE SUBMISSIONS
|
|
|
|
The following postgres query gets all webform **submissions** that are over 6 months old :
|
|
|
|
```
|
|
|
|
select sid, to_timestamp(submitted) from webform_submissions where to_timestamp(submitted) < date_trunc('day', NOW() - interval '6 months') ;
|
|
|
|
```
|
|
|
|
|
|
|
|
The following should delete them :
|
|
|
|
```
|
|
|
|
delete from webform_submissions where to_timestamp(submitted) < date_trunc('day', NOW() - interval '6 months');
|
|
|
|
```
|
|
|
|
|
|
|
|
#### DELETE WEBFORMS
|
|
|
|
The creation timestamp for webforms is stored in the 'created' column of the 'node' table. We also need to filter for node types because all Drupal nodes are stored in the same 'node' table regardless of what they are (page, article, webform).
|
|
|
|
Hence the following request :
|
|
|
|
```
|
|
|
|
delete from node where (type='form1' or type='webform') and to_timestamp(created) < date_trunc('day', NOW() - interval '6 months');
|
|
|
|
```
|
|
|
|
|
|
|
|
## USER NOTIFICATION
|
|
|
|
|
|
|
|
|