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.

Comments

StevenButeneers created an issue. See original summary.

steven buteneers’s picture

Issue summary: View changes
steven buteneers’s picture

StatusFileSize
new1.92 KB

Applied patch to add cron functionality to que old mails to be deleted, using the already available delete callback as worker callback for the que items.

steven buteneers’s picture

Status: Active » Needs review
dmsmidt’s picture

Assigned: steven buteneers » Unassigned
Status: Needs review » Needs work

Some nits:

  1. +++ b/mail_safety.admin.inc
    @@ -40,6 +40,14 @@ function mail_safety_admin_settings_form() {
    +    '#title' => t('Clean up dashboard mails older than the given period'),
    

    Change to:
    Remove stored mails older than the given age.

  2. +++ b/mail_safety.admin.inc
    @@ -40,6 +40,14 @@ function mail_safety_admin_settings_form() {
    +    '#default_value' => variable_get('mail_safety_clean_up_dashboard', 0),
    

    I would rename this variable to: mail_safety_mail_expire.

    This variable should also be deleted on module uninstall.

  3. +++ b/mail_safety.module
    @@ -283,3 +283,38 @@ function theme_mail_safety_details($variables) {
    +  $queues['mail_safety_cleanup'] = array(
    

    Rename to: mail_safety_expire_mails?

  4. +++ b/mail_safety.module
    @@ -283,3 +283,38 @@ function theme_mail_safety_details($variables) {
    +  // Que mail safety mails older than the expiration setting to be deleted.
    

    Typ0's:
    Que/Queue
    mail safety/Mail Safety

steven buteneers’s picture

Added new patch + interdiff

steven buteneers’s picture

Status: Needs work » Needs review
steven buteneers’s picture

Forgot to add the variable_del on uninstall. Re-added patch + interdiff

dmsmidt’s picture

Status: Needs review » Reviewed & tested by the community

Looking good!

steven buteneers’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new374 bytes
new2.3 KB

Found out that the queue retrieved for creating items was wrong, added a new patch + interdiff

dmsmidt’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Needs review » Reviewed & tested by the community

A that I missed that. Good catch. Tested and works.

  • barthje committed c727c36 on 7.x-1.x
    Issue #2894814 by StevenButeneers: Periodic cleanup.
    Issue #2147923 by...
barthje’s picture

Status: Reviewed & tested by the community » Fixed

Added to the new release

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.