4 require_once
'./Services/Logging/classes/public/class.ilLoggerFactory.php';
28 private function deleteAttachments()
32 $attachment_paths =
array();
35 SELECT path, COUNT(mail_id) cnt_mail_ids 37 WHERE '. $ilDB->in(
'mail_id', $this->collector->getMailIdsToDelete(),
false,
'integer').
' 40 while(
$row = $ilDB->fetchAssoc(
$res))
42 $usage_res = $ilDB->queryF(
'SELECT mail_id, path FROM mail_attachment WHERE path = %s',
45 $num_rows = $ilDB->numRows($usage_res);
47 if(
$row[
'cnt_mail_ids'] >= $num_rows)
50 $attachment_paths[
$row[
'mail_id']] = $row[
'path'];
54 foreach($attachment_paths as $mail_id =>
$path)
60 new RecursiveDirectoryIterator(
$path), RecursiveIteratorIterator::CHILD_FIRST);
62 foreach($iter as
$file)
68 $path_name = $file->getPathname();
73 'Attachment directory (%s) deleted for mail_id: %s', $path_name, $mail_id
80 'Attachment file (%s) deleted for mail_id: %s', $path_name, $mail_id
86 'Attachment directory (%s) deleted for mail_id: %s',
$path, $mail_id
92 $ilDB->manipulate(
'DELETE FROM mail_attachment WHERE '. $ilDB->in(
'mail_id', $this->collector->getMailIdsToDelete(),
false,
'integer'));
102 $ilDB->manipulate(
'DELETE FROM mail WHERE ' . $ilDB->in(
'mail_id', $this->collector->getMailIdsToDelete(),
false,
'integer'));
112 if((
int)$ilSetting->get(
'mail_notify_orphaned') >= 1)
114 $ilDB->manipulate(
'DELETE FROM mail_cron_orphaned WHERE ' . $ilDB->in(
'mail_id', $this->collector->getMailIdsToDelete(),
false,
'integer'));
118 $ilDB->manipulate(
'DELETE FROM mail_cron_orphaned');
127 if(count($this->collector->getMailIdsToDelete()) > 0)
130 $this->deleteAttachments();
133 require_once
'./Services/Logging/classes/public/class.ilLoggerFactory.php';
135 'Deleted mail_ids: %s', implode(
', ', $this->collector->getMailIdsToDelete())
140 'Deleted mail_cron_orphaned mail_ids: %s', implode(
', ', $this->collector->getMailIdsToDelete())
__construct(ilMailCronOrphanedMailsDeletionCollector $collector)
ilMailCronOrphanedMailsDeletionProcessor
ilMailCronOrphanedMailsDeletionCollector
Create styles array
The data for the language used.
static getLogger($a_component_id)
Get component logger.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
deleteMarkedAsNotified()
Delete entries about notification.