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 self::SCHEDULE_TYPE_DAILY,
111 self::SCHEDULE_TYPE_WEEKLY,
112 self::SCHEDULE_TYPE_MONTHLY,
113 self::SCHEDULE_TYPE_QUARTERLY,
114 self::SCHEDULE_TYPE_YEARLY,
115 self::SCHEDULE_TYPE_IN_DAYS
125 return self::SCHEDULE_TYPE_DAILY;
151 parent::addCustomSettingsToForm($a_form);
153 $threshold =
new ilNumberInputGUI($this->lng->txt(
'mail_threshold'),
'mail_threshold');
154 $threshold->
setInfo($this->lng->txt(
'mail_threshold_info'));
155 $threshold->allowDecimals(
false);
156 $threshold->setSuffix($this->lng->txt(
'days'));
157 $threshold->setMinValue(1);
158 $threshold->setValue($this->
settings->get(
'mail_threshold'));
162 $mail_folder =
new ilCheckboxInputGUI($this->lng->txt(
'only_inbox_trash'),
'mail_only_inbox_trash');
163 $mail_folder->
setInfo($this->lng->txt(
'only_inbox_trash_info'));
164 $mail_folder->setChecked($this->
settings->get(
'mail_only_inbox_trash'));
165 $a_form->
addItem($mail_folder);
167 $notification =
new ilNumberInputGUI($this->lng->txt(
'mail_notify_orphaned'),
'mail_notify_orphaned');
168 $notification->
setInfo($this->lng->txt(
'mail_notify_orphaned_info'));
169 $notification->allowDecimals(
false);
170 $notification->setSuffix($this->lng->txt(
'days'));
171 $notification->setMinValue(0);
173 $mail_threshold = isset(
$_POST[
'mail_threshold']) ? (int)
$_POST[
'mail_threshold'] : $this->
settings->get(
'mail_threshold');
174 $maxvalue = $mail_threshold - 1;
175 $notification->setMaxValue($maxvalue);
176 $notification->setValue($this->
settings->get(
'mail_notify_orphaned'));
177 $a_form->
addItem($notification);
187 $this->
settings->set(
'mail_threshold', (
int) $a_form->
getInput(
'mail_threshold'));
188 $this->
settings->set(
'mail_only_inbox_trash', (
int) $a_form->
getInput(
'mail_only_inbox_trash'));
189 $this->
settings->set(
'mail_notify_orphaned', (
int) $a_form->
getInput(
'mail_notify_orphaned'));
191 if ($this->
settings->get(
'mail_notify_orphaned') == 0) {
193 $this->db->manipulate(
'DELETE FROM mail_cron_orphaned');
196 "Deleted all scheduled mail deletions because a reminder should't be sent (login: %s|usr_id: %s) anymore!",
197 $this->
user->getLogin(),
212 $mail_threshold = (int) $this->
settings->get(
'mail_threshold');
215 'Started mail deletion job with threshold: %s day(s)',
216 var_export($mail_threshold, 1)
219 if ((
int) $this->
settings->get(
'mail_notify_orphaned') >= 1 && $mail_threshold >= 1) {
223 if ((
int) $this->
settings->get(
'last_cronjob_start_ts', time()) && $mail_threshold >= 1) {
232 'Finished mail deletion job with threshold: %s day(s)',
233 var_export($mail_threshold, 1)
242 include_once
'./Services/Mail/classes/class.ilMailCronOrphanedMailsNotificationCollector.php';
245 include_once
'./Services/Mail/classes/class.ilMailCronOrphanedMailsNotifier.php';
248 (
int) $this->
settings->get(
'mail_threshold'),
249 (int) $this->
settings->get(
'mail_notify_orphaned')
257 include_once
'./Services/Mail/classes/class.ilMailCronOrphanedMailsDeletionCollector.php';
260 include_once
'./Services/Mail/classes/class.ilMailCronOrphanedMailsDeletionProcessor.php';
262 $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.
Cron job result data container.