ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

15 {
16 global $lng;
17
18 $this->lng = $lng;
19 $this->lng->loadLanguageModule("logging");
20 $this->settings = new ilSetting('log');
21 $this->error_settings = ilLoggingErrorSettings::getInstance();
22 }
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 122 of file class.ilLoggerCronCleanErrorFiles.php.

122 {
123 $clear_older_then = new ilTextInputGUI($this->lng->txt('frm_clear_older_then'), 'clear_older_then');
124 $clear_older_then->setValue($this->settings->get('clear_older_then'));
125 $clear_older_then->setInfo($this->lng->txt('frm_clear_older_then_info'));
126
127 $a_form->addItem($clear_older_then);
128 }
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 115 of file class.ilLoggerCronCleanErrorFiles.php.

115 {
116 unlink($path);
117 }
$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 48 of file class.ilLoggerCronCleanErrorFiles.php.

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

55 {
56 return 10;
57 }

◆ getDescription()

ilLoggerCronCleanErrorFiles::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

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

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

◆ getId()

ilLoggerCronCleanErrorFiles::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

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

27 {
28 return "log_error_file_cleanup";
29 }

◆ getTitle()

ilLoggerCronCleanErrorFiles::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

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

34 {
35 return $this->lng->txt("log_error_file_cleanup_title");
36 }

◆ hasAutoActivation()

ilLoggerCronCleanErrorFiles::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

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

62 {
63 return false;
64 }

◆ hasCustomSettings()

ilLoggerCronCleanErrorFiles::hasCustomSettings ( )

Has cron job any custom setting which can be edited?

Returns
boolean

Reimplemented from ilCronJob.

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

76 {
77 return true;
78 }

◆ hasFlexibleSchedule()

ilLoggerCronCleanErrorFiles::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

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

69 {
70 return true;
71 }

◆ readLogDir()

ilLoggerCronCleanErrorFiles::readLogDir (   $path)
protected

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

101 {
102 $ret = array();
103
104 $folder = dir($path);
105 while ($file_name = $folder->read()) {
106 if (filetype($path."/".$file_name) != "dir") {
107 $ret[] = $file_name;
108 }
109 }
110 $folder->close();
111
112 return $ret;
113 }
$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 83 of file class.ilLoggerCronCleanErrorFiles.php.

83 {
85 $files = $this->readLogDir($this->error_settings->folder());
86 $delete_date = new ilDateTime(date("Y-m-d"), IL_CAL_DATE);
87 $delete_date->increment(ilDateTime::DAY, (-1 * $this->settings->get('clear_older_then')));
88
89 foreach ($files as $file) {
90 $file_date = date("Y-m-d", filemtime($this->error_settings->folder()."/".$file));
91
92 if($file_date <= $delete_date->get(IL_CAL_DATE)) {
93 $this->deleteFile($this->error_settings->folder()."/".$file);
94 }
95 }
96
98 return $result;
99 }
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 134 of file class.ilLoggerCronCleanErrorFiles.php.

135 {
136 $this->settings->set('clear_older_then', $a_form->getInput('clear_older_then'));
137 return true;
138 }
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: