ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMailCronOrphanedMailsDeletionCollector Class Reference

ilMailCronOrphanedMailsDeletionCollector More...

+ Collaboration diagram for ilMailCronOrphanedMailsDeletionCollector:

Public Member Functions

 __construct ()
 
 collect ()
 
 addMailIdToDelete ($mail_id)
 
 getMailIdsToDelete ()
 

Protected Attributes

 $db
 
 $settings
 
 $mail_ids = array()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMailCronOrphanedMailsDeletionCollector::__construct ( )

Definition at line 28 of file class.ilMailCronOrphanedMailsDeletionCollector.php.

29 {
30 global $DIC;
31
32 $this->settings = $DIC->settings();
33 $this->db = $DIC->database();
34
35 $this->collect();
36 }
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2

References $DIC, collect(), and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ addMailIdToDelete()

ilMailCronOrphanedMailsDeletionCollector::addMailIdToDelete (   $mail_id)
Parameters
int$mail_id

Definition at line 109 of file class.ilMailCronOrphanedMailsDeletionCollector.php.

110 {
111 $this->mail_ids[] = (int) $mail_id;
112 }

Referenced by collect().

+ Here is the caller graph for this function:

◆ collect()

ilMailCronOrphanedMailsDeletionCollector::collect ( )

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

42 {
43 $mail_only_inbox_trash = (int) $this->settings->get('mail_only_inbox_trash');
44 $last_cron_start_ts = (int) $this->settings->get('last_cronjob_start_ts', time());
45 $mail_notify_orphaned = (int) $this->settings->get('mail_notify_orphaned');
46
47 $now = time();
48
49 if ($mail_notify_orphaned > 0) {
50 if ($last_cron_start_ts != null) {
51 if ($mail_only_inbox_trash) {
52 // überprüfen ob die mail in einen anderen Ordner verschoben wurde
53 // selektiere die, die tatsächlich gelöscht werden sollen
54 $res = $this->db->queryF(
55 "
56 SELECT * FROM mail_cron_orphaned
57 INNER JOIN mail_obj_data mdata ON obj_id = folder_id
58 WHERE ts_do_delete <= %s
59 AND (mdata.m_type = %s OR mdata.m_type = %s)",
60 array('integer', 'text', 'text'),
61 array($now, 'inbox', 'trash')
62 );
63 } else {
64 // selektiere alle zu löschenden mails unabhängig vom ordner..
65 $res = $this->db->queryF(
66 "
67 SELECT * FROM mail_cron_orphaned
68 WHERE ts_do_delete <= %s",
69 array('integer'),
70 array($now)
71 );
72 }
73
74 while ($row = $this->db->fetchAssoc($res)) {
75 $this->addMailIdToDelete($row['mail_id']);
76 }
77 }
78 } else {
79 // mails sollen direkt ohne vorheriger notification gelöscht werden.
80 $mail_threshold = (int) $this->settings->get('mail_threshold');
81 $ts_notify = strtotime("- " . $mail_threshold . " days");
82 $ts_for_deletion = date('Y-m-d', $ts_notify) . ' 23:59:59';
83
84 $types = array('timestamp');
85 $data = array($ts_for_deletion);
86
87 $mails_query = "
88 SELECT mail_id, m.user_id, folder_id, send_time, m_subject, mdata.title
89 FROM mail m
90 INNER JOIN mail_obj_data mdata ON obj_id = folder_id
91 WHERE send_time <= %s";
92
93 if ((int) $this->settings->get('mail_only_inbox_trash') > 0) {
94 $mails_query .= " AND (mdata.m_type = %s OR mdata.m_type = %s)";
95 $types = array('timestamp', 'text', 'text');
96 $data = array($ts_for_deletion, 'inbox', 'trash');
97 }
98
99 $res = $this->db->queryF($mails_query, $types, $data);
100 while ($row = $this->db->fetchAssoc($res)) {
101 $this->addMailIdToDelete($row['mail_id']);
102 }
103 }
104 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
foreach($_POST as $key=> $value) $res

References $data, $res, $row, addMailIdToDelete(), date, and settings().

Referenced by __construct().

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

◆ getMailIdsToDelete()

ilMailCronOrphanedMailsDeletionCollector::getMailIdsToDelete ( )

Field Documentation

◆ $db

ilMailCronOrphanedMailsDeletionCollector::$db
protected

◆ $mail_ids

ilMailCronOrphanedMailsDeletionCollector::$mail_ids = array()
protected

◆ $settings

ilMailCronOrphanedMailsDeletionCollector::$settings
protected

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