ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLoggerCronCleanErrorFiles Class Reference
+ Inheritance diagram for ilLoggerCronCleanErrorFiles:
+ Collaboration diagram for ilLoggerCronCleanErrorFiles:

Public Member Functions

 __construct ()
 
 getId ()
 Get id.
Returns
string
More...
 
 getTitle ()
 Get title.
Returns
string
More...
 
 getDescription ()
 Get description.
Returns
string
More...
 
 getDefaultScheduleType ()
 Get schedule type.
Returns
int
More...
 
 getDefaultScheduleValue ()
 Get schedule value.
Returns
int|array
More...
 
 hasAutoActivation ()
 Is to be activated on "installation".
Returns
boolean
More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured?
Returns
boolean
More...
 
 hasCustomSettings ()
 Has cron job any custom setting which can be edited?
Returns
boolean
More...
 
 run ()
 Run job.
Returns
ilCronJobResult
More...
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 Add custom settings to form.
Parameters
ilPropertyFormGUI$a_form
More...
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 
- 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...
 
 getAllScheduleTypes ()
 Get all available schedule types. More...
 
 getScheduleTypesWithValues ()
 
 getValidScheduleTypes ()
 Returns a collection of all valid schedule types for a specific job. 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...
 

Data Fields

const DEFAULT_VALUE_OLDER_THAN = 31
 
- 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

 readLogDir ($path)
 
 deleteFile ($path)
 
- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)
 

Detailed Description

Definition at line 13 of file class.ilLoggerCronCleanErrorFiles.php.

Constructor & Destructor Documentation

◆ __construct()

ilLoggerCronCleanErrorFiles::__construct ( )

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

18 {
19 global $DIC;
20
21 $lng = $DIC['lng'];
22
23 $this->lng = $lng;
24 $this->lng->loadLanguageModule("logging");
25 $this->settings = new ilSetting('log');
26 $this->error_settings = ilLoggingErrorSettings::getInstance();
27 }
ILIAS Setting Class.
global $DIC
Definition: saml.php:7
$lng
settings()
Definition: settings.php:2

References $DIC, $lng, ilLoggingErrorSettings\getInstance(), and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ addCustomSettingsToForm()

ilLoggerCronCleanErrorFiles::addCustomSettingsToForm ( ilPropertyFormGUI  $a_form)

Add custom settings to form.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilCronJob.

Definition at line 150 of file class.ilLoggerCronCleanErrorFiles.php.

151 {
152 $offset = $this->settings->get('clear_older_then');
153 if (!$offset) {
155 }
156 $clear_older_then = new ilNumberInputGUI($this->lng->txt('frm_clear_older_then'), 'clear_older_then');
157 $clear_older_then->allowDecimals(false);
158 $clear_older_then->setMinValue(1, true);
159 $clear_older_then->setValue($offset);
160 $clear_older_then->setInfo($this->lng->txt('frm_clear_older_then_info'));
161
162 $a_form->addItem($clear_older_then);
163 }
This class represents a number property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).

References ilPropertyFormGUI\addItem(), DEFAULT_VALUE_OLDER_THAN, and settings().

+ Here is the call graph for this function:

◆ deleteFile()

ilLoggerCronCleanErrorFiles::deleteFile (   $path)
protected

Definition at line 142 of file class.ilLoggerCronCleanErrorFiles.php.

143 {
144 unlink($path);
145 }
$path
Definition: aliased.php:25

References $path.

Referenced by run().

+ Here is the caller graph for this function:

◆ getDefaultScheduleType()

ilLoggerCronCleanErrorFiles::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

Definition at line 56 of file class.ilLoggerCronCleanErrorFiles.php.

57 {
59 }
const SCHEDULE_TYPE_IN_DAYS

References ilCronJob\SCHEDULE_TYPE_IN_DAYS.

◆ getDefaultScheduleValue()

ilLoggerCronCleanErrorFiles::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

Definition at line 64 of file class.ilLoggerCronCleanErrorFiles.php.

65 {
66 return 10;
67 }

◆ getDescription()

ilLoggerCronCleanErrorFiles::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

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

49 {
50 return $this->lng->txt("log_error_file_cleanup_info");
51 }

◆ getId()

ilLoggerCronCleanErrorFiles::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

Definition at line 32 of file class.ilLoggerCronCleanErrorFiles.php.

33 {
34 return "log_error_file_cleanup";
35 }

◆ getTitle()

ilLoggerCronCleanErrorFiles::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

Definition at line 40 of file class.ilLoggerCronCleanErrorFiles.php.

41 {
42 return $this->lng->txt("log_error_file_cleanup_title");
43 }

◆ hasAutoActivation()

ilLoggerCronCleanErrorFiles::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

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

73 {
74 return false;
75 }

◆ hasCustomSettings()

ilLoggerCronCleanErrorFiles::hasCustomSettings ( )

Has cron job any custom setting which can be edited?

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 88 of file class.ilLoggerCronCleanErrorFiles.php.

89 {
90 return true;
91 }

◆ hasFlexibleSchedule()

ilLoggerCronCleanErrorFiles::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

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

81 {
82 return true;
83 }

◆ readLogDir()

ilLoggerCronCleanErrorFiles::readLogDir (   $path)
protected

Definition at line 127 of file class.ilLoggerCronCleanErrorFiles.php.

128 {
129 $ret = array();
130
131 $folder = dir($path);
132 while ($file_name = $folder->read()) {
133 if (filetype($path . "/" . $file_name) != "dir") {
134 $ret[] = $file_name;
135 }
136 }
137 $folder->close();
138
139 return $ret;
140 }
$ret
Definition: parser.php:6

References $path, and $ret.

Referenced by run().

+ Here is the caller graph for this function:

◆ run()

ilLoggerCronCleanErrorFiles::run ( )

Run job.

Returns
ilCronJobResult

Reimplemented from ilCronJob.

Definition at line 96 of file class.ilLoggerCronCleanErrorFiles.php.

97 {
99 $folder = $this->error_settings->folder();
100 if (!is_dir($folder)) {
102 $result->setMessage($this->lng->txt("log_error_path_not_configured_or_wrong"));
103 return $result;
104 }
105
106 $offset = $this->settings->get('clear_older_then');
107 if (!$offset) {
109 }
110
111 $files = $this->readLogDir($folder);
112 $delete_date = new ilDateTime(date("Y-m-d"), IL_CAL_DATE);
113 $delete_date->increment(ilDateTime::DAY, (-1 * $offset));
114
115 foreach ($files as $file) {
116 $file_date = date("Y-m-d", filemtime($this->error_settings->folder() . "/" . $file));
117
118 if ($file_date <= $delete_date->get(IL_CAL_DATE)) {
119 $this->deleteFile($this->error_settings->folder() . "/" . $file);
120 }
121 }
122
124 return $result;
125 }
$result
const IL_CAL_DATE
Cron job result data container.
@classDescription Date and time handling
$files
Definition: metarefresh.php:49

References $files, $result, ilDateTime\DAY, DEFAULT_VALUE_OLDER_THAN, deleteFile(), IL_CAL_DATE, readLogDir(), settings(), and ilCronJobResult\STATUS_OK.

+ Here is the call graph for this function:

◆ saveCustomSettings()

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

Reimplemented from ilCronJob.

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

170 {
171 $this->settings->set('clear_older_then', $a_form->getInput('clear_older_then'));
172 return true;
173 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References ilPropertyFormGUI\getInput(), and settings().

+ Here is the call graph for this function:

Field Documentation

◆ DEFAULT_VALUE_OLDER_THAN

const ilLoggerCronCleanErrorFiles::DEFAULT_VALUE_OLDER_THAN = 31

Definition at line 15 of file class.ilLoggerCronCleanErrorFiles.php.

Referenced by addCustomSettingsToForm(), and run().


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