ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 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

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

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

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

Constructor & Destructor Documentation

◆ __construct()

ilLoggerCronCleanErrorFiles::__construct ( )

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

16 {
17 global $lng;
18
19 $this->lng = $lng;
20 $this->lng->loadLanguageModule("logging");
21 $this->settings = new ilSetting('log');
22 $this->error_settings = ilLoggingErrorSettings::getInstance();
23 }
ILIAS Setting Class.
global $lng
Definition: privfeed.php:17
settings()
Definition: settings.php:2

References $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 141 of file class.ilLoggerCronCleanErrorFiles.php.

142 {
143 $clear_older_then = new ilTextInputGUI($this->lng->txt('frm_clear_older_then'), 'clear_older_then');
144 $clear_older_then->setValue($this->settings->get('clear_older_then'));
145 $clear_older_then->setInfo($this->lng->txt('frm_clear_older_then_info'));
146
147 $a_form->addItem($clear_older_then);
148 }
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a text property in a property form.

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

+ Here is the call graph for this function:

◆ deleteFile()

ilLoggerCronCleanErrorFiles::deleteFile (   $path)
protected

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

134 {
135 unlink($path);
136 }

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 52 of file class.ilLoggerCronCleanErrorFiles.php.

53 {
55 }
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 60 of file class.ilLoggerCronCleanErrorFiles.php.

61 {
62 return 10;
63 }

◆ getDescription()

ilLoggerCronCleanErrorFiles::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

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

45 {
46 return $this->lng->txt("log_error_file_cleanup_info");
47 }

◆ getId()

ilLoggerCronCleanErrorFiles::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

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

29 {
30 return "log_error_file_cleanup";
31 }

◆ getTitle()

ilLoggerCronCleanErrorFiles::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

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

37 {
38 return $this->lng->txt("log_error_file_cleanup_title");
39 }

◆ hasAutoActivation()

ilLoggerCronCleanErrorFiles::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

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

69 {
70 return false;
71 }

◆ hasCustomSettings()

ilLoggerCronCleanErrorFiles::hasCustomSettings ( )

Has cron job any custom setting which can be edited?

Returns
boolean

Reimplemented from ilCronJob.

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

85 {
86 return true;
87 }

◆ hasFlexibleSchedule()

ilLoggerCronCleanErrorFiles::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

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

77 {
78 return true;
79 }

◆ readLogDir()

ilLoggerCronCleanErrorFiles::readLogDir (   $path)
protected

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

119 {
120 $ret = array();
121
122 $folder = dir($path);
123 while ($file_name = $folder->read()) {
124 if (filetype($path . "/" . $file_name) != "dir") {
125 $ret[] = $file_name;
126 }
127 }
128 $folder->close();
129
130 return $ret;
131 }
$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 92 of file class.ilLoggerCronCleanErrorFiles.php.

93 {
95 $folder = $this->error_settings->folder();
96 if (!is_dir($folder)) {
98 $result->setMessage($this->lng->txt("log_error_path_not_configured_or_wrong"));
99 return $result;
100 }
101
102 $files = $this->readLogDir($folder);
103 $delete_date = new ilDateTime(date("Y-m-d"), IL_CAL_DATE);
104 $delete_date->increment(ilDateTime::DAY, (-1 * $this->settings->get('clear_older_then')));
105
106 foreach ($files as $file) {
107 $file_date = date("Y-m-d", filemtime($this->error_settings->folder() . "/" . $file));
108
109 if ($file_date <= $delete_date->get(IL_CAL_DATE)) {
110 $this->deleteFile($this->error_settings->folder() . "/" . $file);
111 }
112 }
113
115 return $result;
116 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$result
$files
Definition: add-vimline.php:18
const IL_CAL_DATE
Cron job result data container.
@classDescription Date and time handling
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, $files, $result, date, ilDateTime\DAY, 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 154 of file class.ilLoggerCronCleanErrorFiles.php.

155 {
156 $this->settings->set('clear_older_then', $a_form->getInput('clear_older_then'));
157 return true;
158 }
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:

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