3 declare(strict_types=1);
37 $this->
lng = $DIC->language();
38 $this->
lng->loadLanguageModule(
"logging");
45 return "log_error_file_cleanup";
50 return $this->
lng->txt(
"log_error_file_cleanup_title");
55 return $this->
lng->txt(
"log_error_file_cleanup_info");
60 return JobScheduleType::IN_DAYS;
86 $folder = $this->error_settings->folder();
87 if (!is_dir($folder)) {
88 $result->setStatus(JobResult::STATUS_OK);
89 $result->setMessage($this->
lng->txt(
"log_error_path_not_configured_or_wrong"));
93 $offset = $this->
settings->get(
'clear_older_then',
'');
95 $offset = (
int) $offset;
97 $offset = self::DEFAULT_VALUE_OLDER_THAN;
104 foreach ($files as $file) {
105 $file_date = date(
"Y-m-d", filemtime($this->error_settings->folder() .
"/" . $file));
107 if ($file_date <= $delete_date->
get(
IL_CAL_DATE)) {
108 $this->
deleteFile($this->error_settings->folder() .
"/" . $file);
112 $result->setStatus(JobResult::STATUS_OK);
120 $folder = dir($path);
121 while ($file_name = $folder->read()) {
122 if (filetype($path .
"/" . $file_name) !=
"dir") {
138 $offset = $this->
settings->get(
'clear_older_then',
'');
140 $offset = (string) self::DEFAULT_VALUE_OLDER_THAN;
143 $clear_older_then =
new ilNumberInputGUI($this->
lng->txt(
'frm_clear_older_then'),
'clear_older_then');
145 $clear_older_then->setMinValue(1,
true);
146 $clear_older_then->setValue($offset);
147 $clear_older_then->setInfo($this->
lng->txt(
'frm_clear_older_then_info'));
149 $a_form->
addItem($clear_older_then);
154 $threshold = $a_form->
getInput(
'clear_older_then');
155 if ((
string) $threshold ===
'') {
156 $this->
settings->delete(
'clear_older_then');
158 $this->
settings->set(
'clear_older_then', (
string) ((
int) $a_form->
getInput(
'clear_older_then')));
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addCustomSettingsToForm(ilPropertyFormGUI $a_form)
ilLoggingErrorSettings $error_settings
saveCustomSettings(ilPropertyFormGUI $a_form)
const DEFAULT_VALUE_OLDER_THAN
getDefaultScheduleValue()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...