diff --git a/inc/languages/english/admin/myalerts.lang.php b/inc/languages/english/admin/myalerts.lang.php index f298a0d..760583c 100755 --- a/inc/languages/english/admin/myalerts.lang.php +++ b/inc/languages/english/admin/myalerts.lang.php @@ -17,7 +17,9 @@ $l['setting_myalerts_bc_mode'] = "Backwards compatibility mode"; $l['setting_myalerts_bc_mode_desc'] = "To support client plugins which do not yet register their alerts formatters via this plugin's `myalerts_register_client_alert_formatters` hook. Turning this mode on will resolve the problem of empty alerts rows in the modal dialogue for some client alert types after clicking, for example, 'Mark All Read'."; -$l['myalerts_task_cleanup_ran'] = 'Read alerts over a week old were deleted successfully!'; +// For the task when run from the ACP. +// Duplicated in the user language file for when the task runs in a user context via the task image bottom of page. +$l['myalerts_task_cleanup_ran'] = 'Read alerts over {1} days old and unread alerts over {2} days old were deleted successfully!'; $l['myalerts_task_cleanup_error'] = 'Something went wrong while cleaning up the alerts...'; $l['myalerts_task_title'] = 'MyAlerts Cleanup'; diff --git a/inc/languages/english/myalerts.lang.php b/inc/languages/english/myalerts.lang.php index 4009b07..71b36f6 100755 --- a/inc/languages/english/myalerts.lang.php +++ b/inc/languages/english/myalerts.lang.php @@ -82,3 +82,8 @@ $l['myalerts_error_alert_not_found'] = 'Alert not found.'; $l['myalerts_delete'] = 'Delete'; + +// For the task when run from a user context via the task image bottom of page. +// Duplicated in the admin language file for when the task runs from the ACP. +$l['myalerts_task_cleanup_ran'] = 'Read alerts over {1} days old and unread alerts over {2} days old were deleted successfully!'; +$l['myalerts_task_cleanup_error'] = 'Something went wrong while cleaning up the alerts...'; diff --git a/inc/tasks/myalerts.php b/inc/tasks/myalerts.php index ffc5ed8..915551e 100755 --- a/inc/tasks/myalerts.php +++ b/inc/tasks/myalerts.php @@ -15,17 +15,19 @@ function task_myalerts($task) { global $db, $lang; - + + $read_days = 90; // 90 days for read alerts + $unread_days = 120; // 120 days for unread alerts // Read/unread alerts older than X seconds will be deleted to save some space in DB - $read_time = 90*24*60*60; // 90 days for read alerts (formula: days X hours X minutes X seconds) - $unread_time = 120*24*60*60; // 120 days for unread alerts (formula: days X hours X minutes X seconds) + $read_time = $read_days*24*60*60; // Formula: days X hours X minutes X seconds + $unread_time = $unread_days*24*60*60; //Formula: days X hours X minutes X seconds if (!isset($lang->myalerts)) { $lang->load('myalerts'); } if ($db->delete_query('alerts', '(dateline <= \''.date('Y-m-d H:i:s', TIME_NOW-$unread_time).'\' AND unread = 1) OR (dateline <= \''.date('Y-m-d H:i:s', TIME_NOW-$read_time).'\' AND unread = 0)')) { - add_task_log($task, $lang->myalerts_task_cleanup_ran); + add_task_log($task, $lang->sprintf($lang->myalerts_task_cleanup_ran, $read_days, $unread_days)); } else { add_task_log($task, $lang->myalerts_task_cleanup_error); }