Problem/Motivation
The feature described here -- https://www.drupal.org/project/mail_safety/issues/2894814 -- and added to Drupal 7 release does not exist in more recent versions.
"After enabling saving to the dashboard, mails will stack up and are never cleaned up. This can cause an the database to be overloaded with old mails. Feature request to add a periodic cron clean up, based on the settings the user can provide."
Proposed resolution
Add same functionality to most recent release
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | add_cron_job_to_delete_old_logs-3414182-5.patch | 3.08 KB | nsalves |
Issue fork mail_safety-3414182
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
laboratory.mikeCurrently I have this in a cron job:
We could set this up in a container with dependency injection, and add a config to set the retention time.
Comment #3
flyke commentedThank you laboratory.mike, your solution is a perfect stop gap until we get an actual settings page and this functionality incorporated into the module itself.
Comment #4
drupgirl commented+1 for this essential function being incorporated.
Comment #5
nsalves commentedHere's a patch that adds the functionality. It adds a cron job that reads an offset value configured in the settings page of the module. If no value is configured the cron does nothing and everything remains as it is
Comment #6
nsalves commentedComment #7
sjerdo@nsalves Thanks for providing a patch. Could you create a MR for this change?
There are some code style issues with this patch (in file `mail_safety.module`) which needs attention before we can merge this into the main branch: indent and function doc-block refers to the incorrect hook.
Comment #10
nsalves commentedHello sjerdo, thanks for the feedback and apologies for the oversight. Merge request opened.
Thanks
Comment #11
nsalves commentedComment #12
sjerdoThanks for providing a patch @nsalves
To stay in line with Drupal Core (eg temporary files retention), I've asked @drunxfish to update the MR accordingly, including updating the code style issues.
This wille change the setting from a string to an integer (`-90 days` => `7776000`)
Comment #13
drunxfish commentedComment #15
sjerdoComment #17
sjerdoComment #21
chrisla commentedAny chance of this being added to a release soon?
Comment #22
sjerdoI have tagged a new release 2.2.0 containing this cleanup feature