ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $age->setValue($settings->get('age', ''));
114 }
115
116 $form->addItem($age);
117
118 // limit types
119 $types = new ilSelectInputGUI($lng->txt('sysc_trash_limit_type'), 'types');
120 $sub_objects = $GLOBALS['tree']->lookupTrashedObjectTypes();
121
122 $options = array();
123 $options[0] = '';
124 foreach ($sub_objects as $obj_type) {
125 if (!$GLOBALS['objDefinition']->isRBACObject($obj_type) or !$GLOBALS['objDefinition']->isAllowedInRepository($obj_type)) {
126 continue;
127 }
128 $options[$obj_type] = $lng->txt('obj_' . $obj_type);
129 }
130 asort($options);
131 $types->setOptions($options);
132 $types->setValue($settings->get('types', ''));
133 $form->addItem($types);
134
135 return $form;
136 }
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
This class represents a number property in a property form.
This class represents a selection list property in a property form.
ILIAS Setting Class.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $lng
Definition: privfeed.php:17
if(isset($_POST['submit'])) $form

References $form, $GLOBALS, $lng, and $options.

◆ 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 159 of file class.ilSCCronTrash.php.

160 {
161 include_once './Services/SystemCheck/classes/class.ilSystemCheckTrash.php';
162 $trash = new ilSystemCheckTrash();
164
165 include_once './Services/Administration/classes/class.ilSetting.php';
166 $settings = new ilSetting('sysc');
167
168 $trash->setNumberLimit($settings->get('num', 0));
169 $trash->setTypesLimit((array) $settings->get('types'));
170
171 $age = $settings->get('age', 0);
172 if ($age) {
173 $date = new ilDateTime(time(), IL_CAL_UNIX);
174 $date->increment(IL_CAL_DAY, (int) $age * -1);
175 $trash->setAgeLimit($date);
176 }
177 $trash->start();
178
179 include_once './Services/Cron/classes/class.ilCronJobResult.php';
180 ;
181 $result = new ilCronJobResult();
183 return $result;
184 }
$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 144 of file class.ilSCCronTrash.php.

145 {
146 include_once './Services/Administration/classes/class.ilSetting.php';
147 $settings = new ilSetting('sysc');
148
149 $settings->set('num', $a_form->getInput('number'));
150 $settings->set('age', $a_form->getInput('age'));
151 $settings->set('types', $a_form->getInput('types'));
152
153 return true; // #18579
154 }
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: