MDL-62214 tool_messageinbound: Delete old messages pending verification

This commit is contained in:
Frédéric Massart
2018-05-01 09:21:56 +08:00
parent af099b484c
commit 98a2f802c4
3 changed files with 109 additions and 1 deletions
@@ -310,6 +310,16 @@ class manager {
return true;
}
/**
* Remove older verification failures.
*
* @return void
*/
public function tidy_old_verification_failures() {
global $DB;
$DB->delete_records_select('messageinbound_messagelist', 'timecreated < :time', ['time' => time() - DAYSECS]);
}
/**
* Process a message and pass it through the Inbound Message handling systems.
*
@@ -49,6 +49,7 @@ class cleanup_task extends \core\task\scheduled_task {
*/
public function execute() {
$manager = new \tool_messageinbound\manager();
return $manager->tidy_old_messages();
$manager->tidy_old_messages();
$manager->tidy_old_verification_failures();
}
}