ILIAS
release_6 Revision v6.24-5-g0c8bfefb3b8
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
p
s
t
w
+
Functions
_
a
b
c
f
g
h
i
s
t
w
+
Variables
$
c
d
e
f
g
h
j
l
m
p
s
t
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
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
{
10
private
const
PING_THRESHOLD
= 500;
11
12
private
$job
;
16
protected
$db
;
17
21
protected
$settings
;
22
26
protected
$mail_ids
= array();
27
28
public
function
__construct
(
ilMailCronOrphanedMails
$job
)
29
{
30
global
$DIC
;
31
32
$this->
settings
= $DIC->settings();
33
$this->db = $DIC->database();
34
35
$this->job =
$job
;
36
37
$this->
collect
();
38
}
39
43
public
function
collect
()
44
{
45
$mail_only_inbox_trash = (int) $this->
settings
->get(
'mail_only_inbox_trash'
);
46
$last_cron_start_ts = (int) $this->
settings
->get(
'last_cronjob_start_ts'
, time());
47
$mail_notify_orphaned = (int) $this->
settings
->get(
'mail_notify_orphaned'
);
48
49
$now = time();
50
51
if
($mail_notify_orphaned > 0) {
52
if
($last_cron_start_ts != null) {
53
if
($mail_only_inbox_trash) {
54
// überprüfen ob die mail in einen anderen Ordner verschoben wurde
55
// selektiere die, die tatsächlich gelöscht werden sollen
56
$res
= $this->db->queryF(
57
"
58
SELECT mail_id FROM mail_cron_orphaned
59
LEFT JOIN mail_obj_data mdata ON mdata.obj_id = folder_id
60
WHERE ts_do_delete <= %s
61
AND ((mdata.m_type = %s OR mdata.m_type = %s) OR mdata.obj_id IS NULL)"
,
62
array(
'integer'
,
'text'
,
'text'
),
63
array($now,
'inbox'
,
'trash'
)
64
);
65
}
else
{
66
// selektiere alle zu löschenden mails unabhängig vom ordner..
67
$res
= $this->db->queryF(
68
"
69
SELECT mail_id FROM mail_cron_orphaned
70
WHERE ts_do_delete <= %s"
,
71
array(
'integer'
),
72
array($now)
73
);
74
}
75
76
while
($row = $this->db->fetchAssoc(
$res
)) {
77
$this->
addMailIdToDelete
($row[
'mail_id'
]);
78
}
79
}
80
}
else
{
81
// mails sollen direkt ohne vorheriger notification gelöscht werden.
82
$mail_threshold = (int) $this->
settings
->get(
'mail_threshold'
);
83
$ts_notify = strtotime(
"- "
. $mail_threshold .
" days"
);
84
$ts_for_deletion = date(
'Y-m-d'
, $ts_notify) .
' 23:59:59'
;
85
86
$types = array(
'timestamp'
);
87
$data
= array($ts_for_deletion);
88
89
$mails_query =
"
90
SELECT mail_id
91
FROM mail m
92
INNER JOIN mail_obj_data mdata ON obj_id = folder_id
93
WHERE send_time <= %s"
;
94
95
if
((
int
) $this->
settings
->get(
'mail_only_inbox_trash'
) > 0) {
96
$mails_query .=
" AND (mdata.m_type = %s OR mdata.m_type = %s)"
;
97
$types = array(
'timestamp'
,
'text'
,
'text'
);
98
$data
= array($ts_for_deletion,
'inbox'
,
'trash'
);
99
}
100
101
$i
= 0;
102
$res
= $this->db->queryF($mails_query, $types,
$data
);
103
while
($row = $this->db->fetchAssoc(
$res
)) {
104
if
(
$i
> 0 &&
$i
% self::PING_THRESHOLD) {
105
$this->job->ping();
106
}
107
108
$this->
addMailIdToDelete
($row[
'mail_id'
]);
109
110
++
$i
;
111
}
112
}
113
}
114
118
public
function
addMailIdToDelete
($mail_id)
119
{
120
$this->mail_ids[] = (int) $mail_id;
121
}
122
126
public
function
getMailIdsToDelete
()
127
{
128
return
$this->mail_ids
;
129
}
130
}
ilMailCronOrphanedMailsDeletionCollector\$settings
$settings
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:21
settings
settings()
Definition:
settings.php:2
$data
$data
Definition:
storeScorm.php:23
ilMailCronOrphanedMailsDeletionCollector\addMailIdToDelete
addMailIdToDelete($mail_id)
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:118
ilMailCronOrphanedMailsDeletionCollector\$mail_ids
$mail_ids
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:26
ilMailCronOrphanedMailsDeletionCollector\getMailIdsToDelete
getMailIdsToDelete()
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:126
ilMailCronOrphanedMailsDeletionCollector\PING_THRESHOLD
const PING_THRESHOLD
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:10
ilMailCronOrphanedMailsDeletionCollector\$job
$job
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:12
ilMailCronOrphanedMailsDeletionCollector\$db
$db
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:16
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilMailCronOrphanedMailsDeletionCollector
ilMailCronOrphanedMailsDeletionCollector
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:8
ilMailCronOrphanedMailsDeletionCollector\__construct
__construct(ilMailCronOrphanedMails $job)
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:28
ilMailCronOrphanedMailsDeletionCollector\collect
collect()
Definition:
class.ilMailCronOrphanedMailsDeletionCollector.php:43
$DIC
$DIC
Definition:
xapitoken.php:46
$i
$i
Definition:
metadata.php:24
ilMailCronOrphanedMails
Delete orphaned mails.
Definition:
class.ilMailCronOrphanedMails.php:14
Services
Mail
classes
class.ilMailCronOrphanedMailsDeletionCollector.php
Generated on Sun Apr 13 2025 20:01:21 for ILIAS by
1.8.13 (using
Doxyfile
)