ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilMailCronOrphanedMailsDeletionCollector.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8
class
ilMailCronOrphanedMailsDeletionCollector
9
{
13
protected
$db
;
14
18
protected
$settings
;
19
23
protected
$mail_ids
=
array
();
24
28
public
function
__construct
()
29
{
30
global
$DIC
;
31
32
$this->
settings
= $DIC->settings();
33
$this->db = $DIC->database();
34
35
$this->
collect
();
36
}
37
41
public
function
collect
()
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
}
105
109
public
function
addMailIdToDelete
($mail_id)
110
{
111
$this->mail_ids[] = (int) $mail_id;
112
}
113
117
public
function
getMailIdsToDelete
()
118
{
119
return
$this->mail_ids
;
120
}
121
}
ilMailCronOrphanedMailsDeletionCollector\$settings
$settings
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:18
$DIC
global $DIC
Definition:
saml.php:7
ilMailCronOrphanedMailsDeletionCollector\addMailIdToDelete
addMailIdToDelete($mail_id)
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:109
ilMailCronOrphanedMailsDeletionCollector\$mail_ids
$mail_ids
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:23
ilMailCronOrphanedMailsDeletionCollector\__construct
__construct()
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:28
ilMailCronOrphanedMailsDeletionCollector\getMailIdsToDelete
getMailIdsToDelete()
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:117
ilMailCronOrphanedMailsDeletionCollector\$db
$db
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:13
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
$data
$data
Definition:
test-settings.sample.php:14
date
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Definition:
31docproperties_write-xls.php:86
ilMailCronOrphanedMailsDeletionCollector
ilMailCronOrphanedMailsDeletionCollector
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:8
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
settings
settings()
Definition:
settings.php:2
ilMailCronOrphanedMailsDeletionCollector\collect
collect()
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:41
time
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
Definition:
40duplicateStyle.php:39
$row
$row
Definition:
10autofilter-selection-1.php:74
Services
Mail
classes
class.ilMailCronOrphanedMailsDeletionCollector.php
Generated on Sat Jan 18 2025 19:01:33 for ILIAS by
1.8.13 (using
Doxyfile
)