ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMailCronOrphanedMailsDeletionCollector Class Reference

ilMailCronOrphanedMailsDeletionCollector More...

+ Collaboration diagram for ilMailCronOrphanedMailsDeletionCollector:

Public Member Functions

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

Protected Attributes

 $mail_ids = array()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMailCronOrphanedMailsDeletionCollector::__construct ( )

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

References collect().

+ Here is the call graph for this function:

Member Function Documentation

◆ addMailIdToDelete()

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

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

Referenced by collect().

106  {
107  $this->mail_ids[] = (int)$mail_id;
108  }
+ Here is the caller graph for this function:

◆ collect()

ilMailCronOrphanedMailsDeletionCollector::collect ( )

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

References $data, $ilDB, $ilSetting, $res, $row, addMailIdToDelete(), array, date, and time.

Referenced by __construct().

27  {
28  global $ilDB, $ilSetting;
29 
30  $mail_only_inbox_trash = (int)$ilSetting->get('mail_only_inbox_trash');
31  $last_cron_start_ts = (int)$ilSetting->get('last_cronjob_start_ts');
32 
33  $mail_notify_orphaned = (int)$ilSetting->get('mail_notify_orphaned');
34 
35  $now = time();
36 
37  if($mail_notify_orphaned > 0)
38  {
39  if($last_cron_start_ts != NULL)
40  {
41  if($mail_only_inbox_trash)
42  {
43  // überprüfen ob die mail in einen anderen Ordner verschoben wurde
44  // selektiere die, die tatsächlich gelöscht werden sollen
45  $res = $ilDB->queryF("
46  SELECT * FROM mail_cron_orphaned
47  INNER JOIN mail_obj_data mdata ON obj_id = folder_id
48  WHERE ts_do_delete <= %s
49  AND (mdata.m_type = %s OR mdata.m_type = %s)",
50  array('integer', 'text', 'text'),
51  array($now, 'inbox', 'trash'));
52  }
53  else
54  {
55  // selektiere alle zu löschenden mails unabhängig vom ordner..
56  $res = $ilDB->queryF("
57  SELECT * FROM mail_cron_orphaned
58  WHERE ts_do_delete <= %s",
59  array('integer'),
60  array($now));
61  }
62 
63  while($row = $ilDB->fetchAssoc($res))
64  {
65  $this->addMailIdToDelete($row['mail_id']);
66  }
67  }
68  }
69  else
70  {
71  // mails sollen direkt ohne vorheriger notification gelöscht werden.
72  $mail_threshold = (int)$ilSetting->get('mail_threshold');
73 
74  $ts_notify = strtotime("- ".$mail_threshold." days");
75  $ts_for_deletion = date('Y-m-d', $ts_notify).' 23:59:59';
76 
77  $types = array('timestamp');
78  $data = array($ts_for_deletion);
79 
80  $mails_query = "
81  SELECT mail_id, m.user_id, folder_id, send_time, m_subject, mdata.title
82  FROM mail m
83  INNER JOIN mail_obj_data mdata ON obj_id = folder_id
84  WHERE send_time <= %s";
85 
86  if((int)$ilSetting->get('mail_only_inbox_trash') > 0)
87  {
88  $mails_query .= " AND (mdata.m_type = %s OR mdata.m_type = %s)";
89  $types = array('timestamp', 'text', 'text');
90  $data = array($ts_for_deletion, 'inbox', 'trash');
91  }
92 
93  $res = $ilDB->queryF($mails_query, $types, $data);
94 
95  while($row = $ilDB->fetchAssoc($res))
96  {
97  $this->addMailIdToDelete($row['mail_id']);
98  }
99  }
100  }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
global $ilSetting
Definition: privfeed.php:17
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMailIdsToDelete()

ilMailCronOrphanedMailsDeletionCollector::getMailIdsToDelete ( )

Field Documentation

◆ $mail_ids

ilMailCronOrphanedMailsDeletionCollector::$mail_ids = array()
protected

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