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 ()
 
 getTitle ()
 
 getDescription ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 hasAutoActivation ()
 
 hasFlexibleSchedule ()
 
 hasCustomSettings ()
 
 run ()
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 
 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.

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

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.
settings()
Definition: settings.php:2
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

Member Function Documentation

◆ addCustomSettingsToForm()

ilLoggerCronCleanErrorFiles::addCustomSettingsToForm ( ilPropertyFormGUI  $a_form)

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

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

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.
settings()
Definition: settings.php:2
setValue($a_value)
Set Value.
+ Here is the call graph for this function:

◆ deleteFile()

ilLoggerCronCleanErrorFiles::deleteFile (   $path)
protected

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

References $path.

Referenced by run().

115  {
116  unlink($path);
117  }
$path
Definition: aliased.php:25
+ Here is the caller graph for this function:

◆ getDefaultScheduleType()

ilLoggerCronCleanErrorFiles::getDefaultScheduleType ( )

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

48  {
49  return self::SCHEDULE_TYPE_IN_DAYS;
50  }

◆ getDefaultScheduleValue()

ilLoggerCronCleanErrorFiles::getDefaultScheduleValue ( )

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

55  {
56  return 10;
57  }

◆ getDescription()

ilLoggerCronCleanErrorFiles::getDescription ( )

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

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

◆ getId()

ilLoggerCronCleanErrorFiles::getId ( )

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

27  {
28  return "log_error_file_cleanup";
29  }

◆ getTitle()

ilLoggerCronCleanErrorFiles::getTitle ( )

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

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

◆ hasAutoActivation()

ilLoggerCronCleanErrorFiles::hasAutoActivation ( )

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

62  {
63  return false;
64  }

◆ hasCustomSettings()

ilLoggerCronCleanErrorFiles::hasCustomSettings ( )

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

76  {
77  return true;
78  }

◆ hasFlexibleSchedule()

ilLoggerCronCleanErrorFiles::hasFlexibleSchedule ( )

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.

References $path, $ret, and array.

Referenced by run().

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  }
$path
Definition: aliased.php:25
Create styles array
The data for the language used.
$ret
Definition: parser.php:6
+ Here is the caller graph for this function:

◆ run()

ilLoggerCronCleanErrorFiles::run ( )

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

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

83  {
84  $result = new ilCronJobResult();
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  }
$files
Definition: add-vimline.php:18
$result
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Date and time handling
const IL_CAL_DATE
settings()
Definition: settings.php:2
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
Cron job result data container.
+ Here is the call graph for this function:

◆ saveCustomSettings()

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

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

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

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.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

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