5 include_once
"./Services/Cron/classes/class.ilCronJob.php";
6 include_once
"./Services/Cron/classes/class.ilCronJobResult.php";
7 require_once
'./Services/Logging/classes/public/class.ilLoggerFactory.php';
48 if (!$this->initDone) {
50 $this->lng = $DIC->language();
51 $this->db = $DIC->database();
52 $this->
user = $DIC->user();
54 $this->lng->loadLanguageModule(
'mail');
55 $this->initDone =
true;
65 return "mail_orphaned_mails";
74 return $this->lng->txt(
"mail_orphaned_mails");
83 return $this->lng->txt(
"mail_orphaned_mails_desc");
110 return self::SCHEDULE_TYPE_DAILY;
136 parent::addCustomSettingsToForm($a_form);
138 $threshold =
new ilNumberInputGUI($this->lng->txt(
'mail_threshold'),
'mail_threshold');
139 $threshold->
setInfo($this->lng->txt(
'mail_threshold_info'));
140 $threshold->allowDecimals(
false);
141 $threshold->setSuffix($this->lng->txt(
'days'));
142 $threshold->setMinValue(1);
143 $threshold->setValue($this->
settings->get(
'mail_threshold'));
147 $mail_folder =
new ilCheckboxInputGUI($this->lng->txt(
'only_inbox_trash'),
'mail_only_inbox_trash');
148 $mail_folder->
setInfo($this->lng->txt(
'only_inbox_trash_info'));
149 $mail_folder->setChecked($this->
settings->get(
'mail_only_inbox_trash'));
150 $a_form->
addItem($mail_folder);
152 $notification =
new ilNumberInputGUI($this->lng->txt(
'mail_notify_orphaned'),
'mail_notify_orphaned');
153 $notification->
setInfo($this->lng->txt(
'mail_notify_orphaned_info'));
154 $notification->allowDecimals(
false);
155 $notification->setSuffix($this->lng->txt(
'days'));
156 $notification->setMinValue(0);
158 $mail_threshold = isset(
$_POST[
'mail_threshold']) ? (int)
$_POST[
'mail_threshold'] : $this->
settings->get(
'mail_threshold');
159 $maxvalue = $mail_threshold-1;
160 $notification->setMaxValue($maxvalue);
161 $notification->setValue($this->
settings->get(
'mail_notify_orphaned'));
162 $a_form->
addItem($notification);
172 $this->
settings->set(
'mail_threshold', (
int) $a_form->
getInput(
'mail_threshold'));
173 $this->
settings->set(
'mail_only_inbox_trash', (
int) $a_form->
getInput(
'mail_only_inbox_trash'));
174 $this->
settings->set(
'mail_notify_orphaned', (
int) $a_form->
getInput(
'mail_notify_orphaned'));
176 if ($this->
settings->get(
'mail_notify_orphaned') == 0) {
178 $this->db->manipulate(
'DELETE FROM mail_cron_orphaned');
181 "Deleted all scheduled mail deletions because a reminder should't be sent (login: %s|usr_id: %s) anymore!",
182 $this->
user->getLogin(),
197 $mail_threshold = (int) $this->
settings->get(
'mail_threshold');
200 'Started mail deletion job with threshold: %s day(s)',
201 var_export($mail_threshold, 1)
204 if ((
int) $this->
settings->get(
'mail_notify_orphaned') >= 1 && $mail_threshold >= 1) {
208 if ((
int) $this->
settings->get(
'last_cronjob_start_ts',
time()) && $mail_threshold >= 1) {
217 'Finished mail deletion job with threshold: %s day(s)',
218 var_export($mail_threshold, 1)
227 include_once
'./Services/Mail/classes/class.ilMailCronOrphanedMailsNotificationCollector.php';
230 include_once
'./Services/Mail/classes/class.ilMailCronOrphanedMailsNotifier.php';
233 (
int) $this->
settings->get(
'mail_threshold'),
234 (int) $this->
settings->get(
'mail_notify_orphaned')
242 include_once
'./Services/Mail/classes/class.ilMailCronOrphanedMailsDeletionCollector.php';
245 include_once
'./Services/Mail/classes/class.ilMailCronOrphanedMailsDeletionProcessor.php';
247 $processor->processDeletion();
hasAutoActivation()
Is to be activated on "installation".
Cron job application base class.
getDefaultScheduleType()
Get schedule type.
getDefaultScheduleValue()
Get schedule value.
addCustomSettingsToForm(ilPropertyFormGUI $a_form)
hasFlexibleSchedule()
Can the schedule be configured?
ilMailCronOrphanedMailsDeletionProcessor
saveCustomSettings(ilPropertyFormGUI $a_form)
ilMailCronOrphanedMailsDeletionCollector
ilMailCronOrphanedMailsNotificationCollector
ilMailCronOrphanedMailNotifier
static getLogger($a_component_id)
Get component logger.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
Cron job result data container.