|
|
**note : this is a work in progress. No expiration is yet implemented on Framaforms, causing large database management problems. .**
|
|
|
**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.**
|
|
|
**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 :
|
... | ... | @@ -26,4 +26,10 @@ delete from node where (type='form1' or type='webform') and to_timestamp(created |
|
|
|
|
|
## USER NOTIFICATION
|
|
|
|
|
|
Possible process :
|
|
|
* each day, the Drupal automated cron launches a hook (defined in the framaforms module) which will check in the Postgres tables *node* (webforms) and *webform_submissions* (answers to forms) for rows aged over 6 months, minus two weeks (26 weeks). For each, it will set the "notified" field to 1 in a new "webforms_expiration" table (**to be created**) in the Postgres database.
|
|
|
* the hook will get the corresponding user emails and send them a preconfigured email notifying them of their webform expiration, and giving them a token to extend the webform's lifetime by 6 months.
|
|
|
* accessing this token will set the "notified" field to 2, corresponding to the user having extended the webform by six month (3 = second extension, 4 = fourth, etc.) That way the cron wil only delete every day the webforms aged of exactly 6 months, and whose "notified" field is set to 1 (the user was notified but did nothing).
|
|
|
* the cron should also perform the same process for rows aged over 6 months.
|
|
|
*check the possibility of adding a column to an existing table in postgres*
|
|
|
|