MDL-64400 core_messages: Allow cron to delete unread notifications too
This commit is contained in:
@@ -46,13 +46,18 @@ class messaging_cleanup_task extends scheduled_task {
|
||||
|
||||
$timenow = time();
|
||||
|
||||
// Cleanup messaging.
|
||||
// Cleanup read and unread notifications.
|
||||
if (!empty($CFG->messagingdeleteallnotificationsdelay)) {
|
||||
$notificationdeletetime = $timenow - $CFG->messagingdeleteallnotificationsdelay;
|
||||
$params = array('notificationdeletetime' => $notificationdeletetime);
|
||||
$DB->delete_records_select('notifications', 'timecreated < :notificationdeletetime', $params);
|
||||
}
|
||||
|
||||
// Cleanup read notifications.
|
||||
if (!empty($CFG->messagingdeletereadnotificationsdelay)) {
|
||||
$notificationdeletetime = $timenow - $CFG->messagingdeletereadnotificationsdelay;
|
||||
$params = array('notificationdeletetime' => $notificationdeletetime);
|
||||
$DB->delete_records_select('notifications', 'timeread < :notificationdeletetime', $params);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user