ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilMailCronOrphanedMails Class Reference

Delete orphaned mails. More...

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

Public Member Functions

 __construct ()
 
 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...
 

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
 
- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)
 

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 12 of file class.ilMailCronOrphanedMails.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailCronOrphanedMails::__construct ( )

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

References $lng.

18  {
19  global $lng;
20  $lng->loadLanguageModule('mail');
21  }
global $lng
Definition: privfeed.php:40

Member Function Documentation

◆ addCustomSettingsToForm()

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

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

References $_POST, $ilSetting, $lng, ilPropertyFormGUI\addItem(), and ilFormPropertyGUI\setInfo().

98  {
99  global $ilSetting, $lng;
100 
101  parent::addCustomSettingsToForm($a_form);
102 
103  $threshold = new ilNumberInputGUI($lng->txt('mail_threshold'), 'mail_threshold');
104  $threshold->setInfo($lng->txt('mail_threshold_info'));
105  $threshold->allowDecimals(false);
106  $threshold->setSuffix($lng->txt('days'));
107  $threshold->setMinValue(1);
108  $threshold->setValue($ilSetting->get('mail_threshold'));
109 
110  $a_form->addItem($threshold);
111 
112  $mail_folder = new ilCheckboxInputGUI($lng->txt('only_inbox_trash'), 'mail_only_inbox_trash');
113  $mail_folder->setInfo($lng->txt('only_inbox_trash_info'));
114  $mail_folder->setChecked($ilSetting->get('mail_only_inbox_trash'));
115  $a_form->addItem($mail_folder);
116 
117  $notification = new ilNumberInputGUI($lng->txt('mail_notify_orphaned'), 'mail_notify_orphaned');
118  $notification->setInfo($lng->txt('mail_notify_orphaned_info'));
119  $notification->allowDecimals(false);
120  $notification->setSuffix($lng->txt('days'));
121  $notification->setMinValue(0);
122 
123  $mail_threshold = isset($_POST['mail_threshold']) ? (int)$_POST['mail_threshold'] : $ilSetting->get('mail_threshold');
124  $maxvalue = $mail_threshold-1;
125  $notification->setMaxValue($maxvalue);
126  $notification->setValue($ilSetting->get('mail_notify_orphaned'));
127  $a_form->addItem($notification);
128  }
$_POST['username']
Definition: cron.php:12
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
setInfo($a_info)
Set Information Text.
This class represents a number property in a property form.
global $ilSetting
Definition: privfeed.php:40
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ getDefaultScheduleType()

ilMailCronOrphanedMails::getDefaultScheduleType ( )

Get schedule type.

Returns
int

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

73  {
74  return self::SCHEDULE_TYPE_DAILY;
75  }

◆ getDefaultScheduleValue()

ilMailCronOrphanedMails::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

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

82  {
83  return;
84  }

◆ getDescription()

ilMailCronOrphanedMails::getDescription ( )
Returns
string

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

References $lng.

45  {
46  global $lng;
47  return $lng->txt("mail_orphaned_mails_desc");
48  }
global $lng
Definition: privfeed.php:40

◆ getId()

ilMailCronOrphanedMails::getId ( )

Get id.

Returns
string

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

28  {
29  return "mail_orphaned_mails";
30  }

◆ getTitle()

ilMailCronOrphanedMails::getTitle ( )
Returns
string

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

References $lng.

36  {
37  global $lng;
38  return $lng->txt("mail_orphaned_mails");
39  }
global $lng
Definition: privfeed.php:40

◆ hasAutoActivation()

ilMailCronOrphanedMails::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

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

55  {
56  return false;
57  }

◆ hasCustomSettings()

ilMailCronOrphanedMails::hasCustomSettings ( )
Returns
bool

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

90  {
91  return true;
92  }

◆ hasFlexibleSchedule()

ilMailCronOrphanedMails::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

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

64  {
65  return false;
66  }

◆ processDeletion()

ilMailCronOrphanedMails::processDeletion ( )
private

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

Referenced by run().

189  {
190  include_once './Services/Mail/classes/class.ilMailCronOrphanedMailsDeletionCollector.php';
191  $collector = new ilMailCronOrphanedMailsDeletionCollector();
192 
193  include_once './Services/Mail/classes/class.ilMailCronOrphanedMailsDeletionProcessor.php';
194  $processor = new ilMailCronOrphanedMailsDeletionProcessor($collector);
195  $processor->processDeletion();
196  }
+ Here is the caller graph for this function:

◆ processNotification()

ilMailCronOrphanedMails::processNotification ( )
private

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

Referenced by run().

179  {
180  include_once './Services/Mail/classes/class.ilMailCronOrphanedMailsNotificationCollector.php';
182 
183  include_once'./Services/Mail/classes/class.ilMailCronOrphanedMailsNotifier.php';
184  $notifier = new ilMailCronOrphanedMailsNotifier($collector);
185  $notifier->processNotification();
186  }
+ Here is the caller graph for this function:

◆ run()

ilMailCronOrphanedMails::run ( )

Run job.

Returns
ilCronJobResult

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

References $ilSetting, $result, processDeletion(), processNotification(), and ilCronJobResult\STATUS_OK.

157  {
158  global $ilSetting;
159 
160  $mail_threshold = (int)$ilSetting->get('mail_threshold');
161 
162  if( (int)$ilSetting->get('mail_notify_orphaned') >= 1 && $mail_threshold >= 1)
163  {
164  $this->processNotification();
165  }
166 
167  if((int)$ilSetting->get('last_cronjob_start_ts') && $mail_threshold >= 1)
168  {
169  $this->processDeletion();
170  }
171 
172  $result = new ilCronJobResult();
173  $status = ilCronJobResult::STATUS_OK;
174  $result->setStatus($status);
175  return $result;
176  }
$result
global $ilSetting
Definition: privfeed.php:40
Cron job result data container.
+ Here is the call graph for this function:

◆ saveCustomSettings()

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

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

References $ilDB, $ilSetting, and ilPropertyFormGUI\getInput().

135  {
136  global $ilSetting;
137 
138  $ilSetting->set('mail_threshold', (int)$a_form->getInput('mail_threshold'));
139  $ilSetting->set('mail_only_inbox_trash', (int)$a_form->getInput('mail_only_inbox_trash'));
140  $ilSetting->set('mail_notify_orphaned', (int)$a_form->getInput('mail_notify_orphaned'));
141 
142  if($ilSetting->get('mail_notify_orphaned') == 0)
143  {
144  global $ilDB;
145  //delete all mail_cron_orphaned-table entries!
146  $ilDB->manipulate('DELETE FROM mail_cron_orphaned');
147  }
148 
149  return true;
150  }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
global $ilSetting
Definition: privfeed.php:40
global $ilDB
+ Here is the call graph for this function:

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