ILIAS  release_7 Revision v7.30-3-g800a261c036
ilMailCronOrphanedMailsNotifier Class Reference

ilMailCronOrphanedMailNotifier More...

+ Collaboration diagram for ilMailCronOrphanedMailsNotifier:

Public Member Functions

 __construct (ilMailCronOrphanedMails $job, ilMailCronOrphanedMailsNotificationCollector $collector, $threshold, $mail_notify_orphaned)
 ilMailCronOrphanedMailsNotifier constructor. More...
 
 processNotification ()
 

Protected Attributes

 $collector
 
 $db
 
 $threshold = 0
 
 $mail_notify_orphaned = 0
 

Private Member Functions

 markAsNotified (ilMailCronOrphanedMailsNotificationCollectionObj $collection_obj)
 
 sendMail (ilMailCronOrphanedMailsNotificationCollectionObj $collection_obj)
 

Private Attributes

const NOTIFICATION_MARKER_PING_THRESHOLD = 250
 
const MAIL_DELIVERY_PING_THRESHOLD = 25
 
 $job
 
 $mark_as_notified_stmt
 

Detailed Description

ilMailCronOrphanedMailNotifier

Author
Nadia Matuschek nmatu.nosp@m.sche.nosp@m.k@dat.nosp@m.abay.nosp@m..de

Definition at line 8 of file class.ilMailCronOrphanedMailsNotifier.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailCronOrphanedMailsNotifier::__construct ( ilMailCronOrphanedMails  $job,
ilMailCronOrphanedMailsNotificationCollector  $collector,
  $threshold,
  $mail_notify_orphaned 
)

ilMailCronOrphanedMailsNotifier constructor.

Parameters
ilMailCronOrphanedMailsNotificationCollector$collector
int$threshold
int$mail_notify_orphaned

Definition at line 41 of file class.ilMailCronOrphanedMailsNotifier.php.

42 {
43 global $DIC;
44
45 $this->db = $DIC->database();
46
47 $this->job = $job;
48 $this->collector = $collector;
49 $this->threshold = $threshold;
50 $this->mail_notify_orphaned = $mail_notify_orphaned;
51
52 $this->mark_as_notified_stmt = $this->db->prepareManip(
53 'INSERT INTO mail_cron_orphaned (mail_id, folder_id, ts_do_delete) VALUES (?, ?, ?)',
55 );
56 }
global $DIC
Definition: goto.php:24

References $collector, $DIC, $job, $mail_notify_orphaned, $threshold, and ilDBConstants\T_INTEGER.

Member Function Documentation

◆ markAsNotified()

ilMailCronOrphanedMailsNotifier::markAsNotified ( ilMailCronOrphanedMailsNotificationCollectionObj  $collection_obj)
private
Parameters
ilMailCronOrphanedMailsNotificationCollectionObj$collection_obj

Definition at line 61 of file class.ilMailCronOrphanedMailsNotifier.php.

62 {
63 if ($this->threshold > $this->mail_notify_orphaned) {
64 $notify_days_before = $this->threshold - $this->mail_notify_orphaned;
65 } else {
66 $notify_days_before = 1;
67 }
68
69 $ts_delete = strtotime("+ " . $notify_days_before . " days");
70 $ts_for_deletion = mktime(0, 0, 0, date('m', $ts_delete), date('d', $ts_delete), date('Y', $ts_delete));
71
72 $i = 0;
73 foreach ($collection_obj->getFolderObjects() as $folder_obj) {
74 $folder_id = $folder_obj->getFolderId();
75
76 foreach ($folder_obj->getOrphanedMailObjects() as $mail_obj) {
77 $mail_id = $mail_obj->getMailId();
78
79 if ($i > 0 && $i % self::NOTIFICATION_MARKER_PING_THRESHOLD === 0) {
80 $this->job->ping();
81 }
82
83 $this->db->execute(
84 $this->mark_as_notified_stmt,
85 [$mail_id, $folder_id, $ts_for_deletion]
86 );
87 $i++;
88 }
89 }
90 }
$i
Definition: metadata.php:24

References $i, $mail_notify_orphaned, and ilMailCronOrphanedMailsNotificationCollectionObj\getFolderObjects().

Referenced by processNotification().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processNotification()

ilMailCronOrphanedMailsNotifier::processNotification ( )

Definition at line 108 of file class.ilMailCronOrphanedMailsNotifier.php.

109 {
110 $i = 0;
111 foreach ($this->collector->getCollection() as $collection_obj) {
112 if ($i > 0 && $i % self::MAIL_DELIVERY_PING_THRESHOLD === 0) {
113 $this->job->ping();
114 }
115
116 $this->sendMail($collection_obj);
117 $this->markAsNotified($collection_obj);
118 ++$i;
119 }
120 }
markAsNotified(ilMailCronOrphanedMailsNotificationCollectionObj $collection_obj)
sendMail(ilMailCronOrphanedMailsNotificationCollectionObj $collection_obj)

References $i, markAsNotified(), and sendMail().

+ Here is the call graph for this function:

◆ sendMail()

ilMailCronOrphanedMailsNotifier::sendMail ( ilMailCronOrphanedMailsNotificationCollectionObj  $collection_obj)
private
Parameters
ilMailCronOrphanedMailsNotificationCollectionObj$collection_obj

Definition at line 95 of file class.ilMailCronOrphanedMailsNotifier.php.

96 {
97 include_once './Services/Mail/classes/class.ilMailCronOrphanedMailsNotification.php';
99
100 $mail->setRecipients(array($collection_obj->getUserId()));
101 $mail->setAdditionalInformation(array('mail_folders' => $collection_obj->getFolderObjects()));
102 $mail->send();
103 }

References ilMailCronOrphanedMailsNotificationCollectionObj\getFolderObjects(), and ilMailCronOrphanedMailsNotificationCollectionObj\getUserId().

Referenced by processNotification().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $collector

ilMailCronOrphanedMailsNotifier::$collector
protected

Definition at line 17 of file class.ilMailCronOrphanedMailsNotifier.php.

Referenced by __construct().

◆ $db

ilMailCronOrphanedMailsNotifier::$db
protected

Definition at line 22 of file class.ilMailCronOrphanedMailsNotifier.php.

◆ $job

ilMailCronOrphanedMailsNotifier::$job
private

Definition at line 13 of file class.ilMailCronOrphanedMailsNotifier.php.

Referenced by __construct().

◆ $mail_notify_orphaned

ilMailCronOrphanedMailsNotifier::$mail_notify_orphaned = 0
protected

Definition at line 32 of file class.ilMailCronOrphanedMailsNotifier.php.

Referenced by __construct(), and markAsNotified().

◆ $mark_as_notified_stmt

ilMailCronOrphanedMailsNotifier::$mark_as_notified_stmt
private

Definition at line 33 of file class.ilMailCronOrphanedMailsNotifier.php.

◆ $threshold

ilMailCronOrphanedMailsNotifier::$threshold = 0
protected

Definition at line 27 of file class.ilMailCronOrphanedMailsNotifier.php.

Referenced by __construct().

◆ MAIL_DELIVERY_PING_THRESHOLD

const ilMailCronOrphanedMailsNotifier::MAIL_DELIVERY_PING_THRESHOLD = 25
private

Definition at line 11 of file class.ilMailCronOrphanedMailsNotifier.php.

◆ NOTIFICATION_MARKER_PING_THRESHOLD

const ilMailCronOrphanedMailsNotifier::NOTIFICATION_MARKER_PING_THRESHOLD = 250
private

Definition at line 10 of file class.ilMailCronOrphanedMailsNotifier.php.


The documentation for this class was generated from the following file: