19declare(strict_types=1);
54 $this->db =
$db ??
$DIC->database();
62 $this->mark_as_notified_stmt = $this->db->prepareManip(
63 'INSERT INTO mail_cron_orphaned (mail_id, folder_id, ts_do_delete) VALUES (?, ?, ?)',
70 $notify_days_before = 1;
71 if ($this->mail_expiration_days > $this->mail_expiration_warning_days) {
75 $deletion_datetime = $this->clock->now()
76 ->modify(
'+ ' . $notify_days_before .
' days')
81 $folder_id = $folder_obj->getFolderId();
83 foreach ($folder_obj->getOrphanedMailObjects() as $mail_obj) {
84 $mail_id = $mail_obj->getMailId();
86 if (
$i > 0 &&
$i % self::NOTIFICATION_MARKER_PING_THRESHOLD === 0) {
91 $this->mark_as_notified_stmt,
92 [$mail_id, $folder_id, $deletion_datetime->getTimestamp()]
102 $mail->setRecipients([$collection_obj->
getUserId()]);
103 $mail->setAdditionalInformation([
'mail_folders' => $collection_obj->
getFolderObjects()]);
110 foreach ($this->collector->getCollection() as $collection_obj) {
111 if (
$i > 0 &&
$i % self::MAIL_DELIVERY_PING_THRESHOLD === 0) {
ilMailCronOrphanedMails $job
__construct(ilMailCronOrphanedMails $job, NotificationsCollector $collector, int $mail_expiration_days, int $mail_expiration_warning_days, ?ilDBInterface $db=null, ?ClockInterface $clock=null)
const NOTIFICATION_MARKER_PING_THRESHOLD
const MAIL_DELIVERY_PING_THRESHOLD
sendMail(ReportDto $collection_obj)
markAsNotified(ReportDto $collection_obj)
int $mail_expiration_days
NotificationsCollector $collector
ilDBStatement $mark_as_notified_stmt
int $mail_expiration_warning_days
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...