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

Purge trash by cron. More...

+ Inheritance diagram for ilSCCronTrash:
+ Collaboration diagram for ilSCCronTrash:

Public Member Functions

 getId ()
 Get id. More...
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getValidScheduleTypes ()
 Get all available schedule types. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 hasCustomSettings ()
 
 addCustomSettingsToForm (ilPropertyFormGUI $form)
 Add custom settings to form. More...
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 Save custom settings. More...
 
 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...
 

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

Purge trash by cron.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 11 of file class.ilSCCronTrash.php.

Member Function Documentation

◆ addCustomSettingsToForm()

ilSCCronTrash::addCustomSettingsToForm ( ilPropertyFormGUI  $form)

Add custom settings to form.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilCronJob.

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

90 {
91 global $lng;
92
93 $lng->loadLanguageModule('sysc');
94
95 include_once './Services/Administration/classes/class.ilSetting.php';
96 $settings = new ilSetting('sysc');
97
98 // limit number
99 $num = new ilNumberInputGUI($lng->txt('sysc_trash_limit_num'), 'number');
100 $num->setInfo($lng->txt('purge_count_limit_desc'));
101 $num->setSize(10);
102 $num->setMinValue(1);
103 $num->setValue($settings->get('num',''));
104 $form->addItem($num);
105
106 $age = new ilNumberInputGUI($lng->txt('sysc_trash_limit_age'), 'age');
107 $age->setInfo($lng->txt('purge_age_limit_desc'));
108 $age->setSize(4);
109 $age->setMinValue(1);
110 $age->setMaxLength(4);
111
112 if($settings->get('age',''))
113 {
114 $age->setValue($settings->get('age',''));
115 }
116
117 $form->addItem($age);
118
119 // limit types
120 $types = new ilSelectInputGUI($lng->txt('sysc_trash_limit_type'), 'types');
121 $sub_objects = $GLOBALS['tree']->lookupTrashedObjectTypes();
122
123 $options = array();
124 $options[0] = '';
125 foreach($sub_objects as $obj_type)
126 {
127 if(!$GLOBALS['objDefinition']->isRBACObject($obj_type) or !$GLOBALS['objDefinition']->isAllowedInRepository($obj_type))
128 {
129 continue;
130 }
131 $options[$obj_type] = $lng->txt('obj_'.$obj_type);
132 }
133 asort($options);
134 $types->setOptions($options);
135 $types->setValue($settings->get('types', ''));
136 $form->addItem($types);
137
138 return $form;
139 }
This class represents a number property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a selection list property in a property form.
ILIAS Setting Class.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
global $lng
Definition: privfeed.php:40
if(!is_array($argv)) $options

References $GLOBALS, $lng, $options, and ilPropertyFormGUI\addItem().

+ Here is the call graph for this function:

◆ getDefaultScheduleType()

ilSCCronTrash::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

Definition at line 38 of file class.ilSCCronTrash.php.

39 {
41 }
const SCHEDULE_TYPE_WEEKLY

References ilCronJob\SCHEDULE_TYPE_WEEKLY.

◆ getDefaultScheduleValue()

ilSCCronTrash::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

Definition at line 60 of file class.ilSCCronTrash.php.

61 {
62 return 1;
63 }

◆ getDescription()

ilSCCronTrash::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

Definition at line 30 of file class.ilSCCronTrash.php.

31 {
32 global $lng;
33
34 $GLOBALS['lng']->loadLanguageModule('sysc');
35 return $lng->txt('sysc_cron_empty_trash_desc');
36 }

References $GLOBALS, and $lng.

◆ getId()

ilSCCronTrash::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

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

18 {
19 return 'sysc_trash';
20 }

◆ getTitle()

ilSCCronTrash::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

Definition at line 22 of file class.ilSCCronTrash.php.

23 {
24 global $lng;
25
26 $GLOBALS['lng']->loadLanguageModule('sysc');
27 return $lng->txt('sysc_cron_empty_trash');
28 }

References $GLOBALS, and $lng.

◆ getValidScheduleTypes()

ilSCCronTrash::getValidScheduleTypes ( )

Get all available schedule types.

Returns
int

Reimplemented from ilCronJob.

Definition at line 48 of file class.ilSCCronTrash.php.

49 {
50 return array(
51 self::SCHEDULE_TYPE_DAILY,
52 self::SCHEDULE_TYPE_WEEKLY,
53 self::SCHEDULE_TYPE_MONTHLY,
54 self::SCHEDULE_TYPE_QUARTERLY,
55 self::SCHEDULE_TYPE_YEARLY
56 );
57 }

◆ hasAutoActivation()

ilSCCronTrash::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 65 of file class.ilSCCronTrash.php.

66 {
67 return false;
68 }

◆ hasCustomSettings()

ilSCCronTrash::hasCustomSettings ( )
Returns
bool

Reimplemented from ilCronJob.

Definition at line 78 of file class.ilSCCronTrash.php.

79 {
80 return TRUE;
81 }

◆ hasFlexibleSchedule()

ilSCCronTrash::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 70 of file class.ilSCCronTrash.php.

71 {
72 return true;
73 }

◆ run()

ilSCCronTrash::run ( )

Run job.

Returns
ilCronJobResult

Reimplemented from ilCronJob.

Definition at line 162 of file class.ilSCCronTrash.php.

163 {
164 include_once './Services/SystemCheck/classes/class.ilSystemCheckTrash.php';
165 $trash = new ilSystemCheckTrash();
167
168 include_once './Services/Administration/classes/class.ilSetting.php';
169 $settings = new ilSetting('sysc');
170
171 $trash->setNumberLimit($settings->get('num',0));
172 $trash->setTypesLimit((array) $settings->get('types'));
173
174 $age = $settings->get('age',0);
175 if($age)
176 {
177 $date = new ilDateTime(time(),IL_CAL_UNIX);
178 $date->increment(IL_CAL_DAY, (int) $age * -1);
179 $trash->setAgeLimit($date);
180 }
181 $trash->start();
182
183 include_once './Services/Cron/classes/class.ilCronJobResult.php';;
184 $result = new ilCronJobResult();
186 return $result;
187 }
$result
const IL_CAL_UNIX
const IL_CAL_DAY
Cron job result data container.
@classDescription Date and time handling

References $result, IL_CAL_DAY, IL_CAL_UNIX, ilSystemCheckTrash\MODE_TRASH_REMOVE, and ilCronJobResult\STATUS_OK.

◆ saveCustomSettings()

ilSCCronTrash::saveCustomSettings ( ilPropertyFormGUI  $a_form)

Save custom settings.

Parameters
ilPropertyFormGUI$a_form
Returns
boolean

Reimplemented from ilCronJob.

Definition at line 147 of file class.ilSCCronTrash.php.

148 {
149 include_once './Services/Administration/classes/class.ilSetting.php';
150 $settings = new ilSetting('sysc');
151
152 $settings->set('num', $a_form->getInput('number'));
153 $settings->set('age',$a_form->getInput('age'));
154 $settings->set('types',$a_form->getInput('types'));
155
156 return true; // #18579
157 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

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