48 if ($DIC->offsetExists(
'lng')) {
51 if ($DIC->offsetExists(
'filesystem')) {
52 $this->
filesystem = $DIC->filesystem()->temp();
54 if ($DIC->offsetExists(
'ilLoggerFactory')) {
55 $this->
logger = $DIC->logger()->root();
65 return "file_system_clean_temp_dir";
70 return $this->
language->txt(
'file_system_clean_temp_dir_cron');
75 return $this->
language->txt(
"file_system_clean_temp_dir_cron_info");
90 return JobScheduleType::DAILY;
102 $date =
"until 10 day ago";
105 $files = $this->
filesystem->finder()->in([
""]);
106 $files = $files->files();
107 $files = $files->date($date);
108 $files = $files->getIterator();
111 while ($files->valid()) {
113 $file_match = $files->current();
114 $path = $file_match->getPath();
115 if ($file_match->isFile()) {
117 $deleted_files[] =
$path;
122 "Cron Job \"Clean temp directory\" could not delete " .
$path 123 .
"due to the following exception: " . $t->getMessage()
131 $folders = $this->
filesystem->finder()->in([
""]);
132 $folders = $folders->directories();
133 $folders = $folders->date($date);
134 $folders = $folders->sort(fn(
138 $folders = $folders->reverseSorting();
139 $folders = $folders->getIterator();
141 $deleted_folders = [];
144 while ($folders->valid()) {
146 $folder_match = $folders->current();
147 $path = $folder_match->getPath();
148 if ($folder_match->isDir()) {
150 $deleted_folders[] =
$path;
155 "Cron Job \"Clean temp directory\" could not delete " .
$path 156 .
"due to the following exception: " . $t->getMessage()
162 $num_folders = count($deleted_folders);
163 $num_files = count($deleted_files);
166 $result->setMessage($num_folders .
" folders and " . $num_files .
" files have been deleted.");
167 $result->setStatus(JobResult::STATUS_OK);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilFileSystemCleanTempDirCron.
__construct(Container $dic, ilPlugin $plugin)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
language()
description: > Example for rendring a language glyph.
getDefaultScheduleValue()