ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMailCronOrphanedMails Class Reference

Delete orphaned mails. More...

+ Inheritance diagram for ilMailCronOrphanedMails:
+ Collaboration diagram for ilMailCronOrphanedMails:

Public Member Functions

 getId ()
 Get id. More...
 
 getTitle ()
 
 getDescription ()
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 hasCustomSettings ()
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 
 run ()
 Run job. More...
 
- Public Member Functions inherited from ilCronJob
 isActive ($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual=false)
 Is job currently active? More...
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule ($a_type, $a_value)
 Update current schedule (if flexible) More...
 
 getValidScheduleTypes ()
 Get all available schedule types. More...
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. More...
 
 isManuallyExecutable ()
 Defines whether or not a cron job can be started manually. More...
 
 hasCustomSettings ()
 Has cron job any custom setting which can be edited? More...
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 Add custom settings to form. More...
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 Save custom settings. More...
 
 addToExternalSettingsForm ($a_form_id, array &$a_fields, $a_is_active)
 Add external settings to form. More...
 
 activationWasToggled ($a_currently_active)
 Cron job status was changed. More...
 
 getId ()
 Get id. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 run ()
 Run job. More...
 

Protected Member Functions

 init ()
 
- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)
 

Protected Attributes

 $lng
 
 $settings
 
 $db
 
 $user
 
 $initDone = false
 

Private Member Functions

 processNotification ()
 
 processDeletion ()
 

Additional Inherited Members

- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 
const SCHEDULE_TYPE_IN_HOURS = 3
 
const SCHEDULE_TYPE_IN_DAYS = 4
 
const SCHEDULE_TYPE_WEEKLY = 5
 
const SCHEDULE_TYPE_MONTHLY = 6
 
const SCHEDULE_TYPE_QUARTERLY = 7
 
const SCHEDULE_TYPE_YEARLY = 8
 

Detailed Description

Delete orphaned mails.

Author
Nadia Matuschek nmatu.nosp@m.sche.nosp@m.k@dat.nosp@m.abay.nosp@m..de

Definition at line 14 of file class.ilMailCronOrphanedMails.php.

Member Function Documentation

◆ addCustomSettingsToForm()

ilMailCronOrphanedMails::addCustomSettingsToForm ( ilPropertyFormGUI  $a_form)
Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilCronJob.

Definition at line 133 of file class.ilMailCronOrphanedMails.php.

134 {
135 $this->init();
136 parent::addCustomSettingsToForm($a_form);
137
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'));
144
145 $a_form->addItem($threshold);
146
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);
151
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);
157
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);
163 }
$_POST["username"]
This class represents a checkbox property in a property form.
This class represents a number property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
settings()
Definition: settings.php:2

References $_POST, ilPropertyFormGUI\addItem(), init(), and settings().

+ Here is the call graph for this function:

◆ getDefaultScheduleType()

ilMailCronOrphanedMails::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

Definition at line 108 of file class.ilMailCronOrphanedMails.php.

109 {
111 }
const SCHEDULE_TYPE_DAILY

References ilCronJob\SCHEDULE_TYPE_DAILY.

◆ getDefaultScheduleValue()

ilMailCronOrphanedMails::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

Definition at line 117 of file class.ilMailCronOrphanedMails.php.

118 {
119 return 1;
120 }

◆ getDescription()

ilMailCronOrphanedMails::getDescription ( )
Returns
string

Reimplemented from ilCronJob.

Definition at line 80 of file class.ilMailCronOrphanedMails.php.

81 {
82 $this->init();
83 return $this->lng->txt("mail_orphaned_mails_desc");
84 }

References init().

+ Here is the call graph for this function:

◆ getId()

ilMailCronOrphanedMails::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

Definition at line 63 of file class.ilMailCronOrphanedMails.php.

64 {
65 return "mail_orphaned_mails";
66 }

◆ getTitle()

ilMailCronOrphanedMails::getTitle ( )
Returns
string

Reimplemented from ilCronJob.

Definition at line 71 of file class.ilMailCronOrphanedMails.php.

72 {
73 $this->init();
74 return $this->lng->txt("mail_orphaned_mails");
75 }

References init().

+ Here is the call graph for this function:

◆ hasAutoActivation()

ilMailCronOrphanedMails::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 90 of file class.ilMailCronOrphanedMails.php.

91 {
92 return false;
93 }

◆ hasCustomSettings()

ilMailCronOrphanedMails::hasCustomSettings ( )
Returns
bool

Reimplemented from ilCronJob.

Definition at line 125 of file class.ilMailCronOrphanedMails.php.

126 {
127 return true;
128 }

◆ hasFlexibleSchedule()

ilMailCronOrphanedMails::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 99 of file class.ilMailCronOrphanedMails.php.

100 {
101 return false;
102 }

◆ init()

ilMailCronOrphanedMails::init ( )
protected

Definition at line 44 of file class.ilMailCronOrphanedMails.php.

45 {
46 global $DIC;
47
48 if (!$this->initDone) {
49 $this->settings = $DIC->settings();
50 $this->lng = $DIC->language();
51 $this->db = $DIC->database();
52 $this->user = $DIC->user();
53
54 $this->lng->loadLanguageModule('mail');
55 $this->initDone = true;
56 }
57 }
user()
Definition: user.php:4
global $DIC
Definition: saml.php:7

References $DIC, settings(), and user().

Referenced by addCustomSettingsToForm(), getDescription(), getTitle(), processDeletion(), processNotification(), run(), and saveCustomSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processDeletion()

ilMailCronOrphanedMails::processDeletion ( )
private

Definition at line 239 of file class.ilMailCronOrphanedMails.php.

240 {
241 $this->init();
242 include_once './Services/Mail/classes/class.ilMailCronOrphanedMailsDeletionCollector.php';
244
245 include_once './Services/Mail/classes/class.ilMailCronOrphanedMailsDeletionProcessor.php';
246 $processor = new ilMailCronOrphanedMailsDeletionProcessor($collector);
247 $processor->processDeletion();
248 }

References init().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processNotification()

ilMailCronOrphanedMails::processNotification ( )
private

Definition at line 224 of file class.ilMailCronOrphanedMails.php.

225 {
226 $this->init();
227 include_once './Services/Mail/classes/class.ilMailCronOrphanedMailsNotificationCollector.php';
229
230 include_once'./Services/Mail/classes/class.ilMailCronOrphanedMailsNotifier.php';
231 $notifier = new ilMailCronOrphanedMailsNotifier(
232 $collector,
233 (int) $this->settings->get('mail_threshold'),
234 (int) $this->settings->get('mail_notify_orphaned')
235 );
236 $notifier->processNotification();
237 }

References init(), and settings().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run()

ilMailCronOrphanedMails::run ( )

Run job.

Returns
ilCronJobResult

Reimplemented from ilCronJob.

Definition at line 194 of file class.ilMailCronOrphanedMails.php.

195 {
196 $this->init();
197 $mail_threshold = (int) $this->settings->get('mail_threshold');
198
200 'Started mail deletion job with threshold: %s day(s)',
201 var_export($mail_threshold, 1)
202 ));
203
204 if ((int) $this->settings->get('mail_notify_orphaned') >= 1 && $mail_threshold >= 1) {
205 $this->processNotification();
206 }
207
208 if ((int) $this->settings->get('last_cronjob_start_ts', time()) && $mail_threshold >= 1) {
209 $this->processDeletion();
210 }
211
212 $result = new ilCronJobResult();
214 $result->setStatus($status);
215
217 'Finished mail deletion job with threshold: %s day(s)',
218 var_export($mail_threshold, 1)
219 ));
220
221 return $result;
222 }
sprintf('%.4f', $callTime)
$result
Cron job result data container.
static getLogger($a_component_id)
Get component logger.

References $result, ilLoggerFactory\getLogger(), init(), processDeletion(), processNotification(), settings(), sprintf, and ilCronJobResult\STATUS_OK.

+ Here is the call graph for this function:

◆ saveCustomSettings()

ilMailCronOrphanedMails::saveCustomSettings ( ilPropertyFormGUI  $a_form)
Parameters
ilPropertyFormGUI$a_form
Returns
bool

Reimplemented from ilCronJob.

Definition at line 169 of file class.ilMailCronOrphanedMails.php.

170 {
171 $this->init();
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'));
175
176 if ($this->settings->get('mail_notify_orphaned') == 0) {
177 //delete all mail_cron_orphaned-table entries!
178 $this->db->manipulate('DELETE FROM mail_cron_orphaned');
179
181 "Deleted all scheduled mail deletions because a reminder should't be sent (login: %s|usr_id: %s) anymore!",
182 $this->user->getLogin(),
183 $this->user->getId()
184 ));
185 }
186
187 return true;
188 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References ilPropertyFormGUI\getInput(), ilLoggerFactory\getLogger(), init(), settings(), sprintf, and user().

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilMailCronOrphanedMails::$db
protected

Definition at line 29 of file class.ilMailCronOrphanedMails.php.

◆ $initDone

ilMailCronOrphanedMails::$initDone = false
protected

Definition at line 39 of file class.ilMailCronOrphanedMails.php.

◆ $lng

ilMailCronOrphanedMails::$lng
protected

Definition at line 19 of file class.ilMailCronOrphanedMails.php.

◆ $settings

ilMailCronOrphanedMails::$settings
protected

Definition at line 24 of file class.ilMailCronOrphanedMails.php.

◆ $user

ilMailCronOrphanedMails::$user
protected

Definition at line 34 of file class.ilMailCronOrphanedMails.php.


The documentation for this class was generated from the following file: