44        if (
$DIC->offsetExists(
'lng')) {
 
   47        if (
$DIC->offsetExists(
'filesystem')) {
 
   48            $this->
filesystem = $DIC->filesystem()->temp();
 
   50        if (
$DIC->offsetExists(
'ilLoggerFactory')) {
 
   51            $this->
logger = $DIC->logger()->root();
 
   61        return "file_system_clean_temp_dir";
 
   66        return $this->
language->txt(
'file_system_clean_temp_dir_cron');
 
   71        return $this->
language->txt(
"file_system_clean_temp_dir_cron_info");
 
   98        $date = 
"until 10 day ago";
 
  101        $files = $this->
filesystem->finder()->in([
""]);
 
  102        $files = $files->files();
 
  103        $files = $files->date($date);
 
  104        $files = $files->getIterator();
 
  107        while ($files->valid()) {
 
  109                $file_match = $files->current();
 
  110                $path = $file_match->getPath();
 
  111                if ($file_match->isFile()) {
 
  113                    $deleted_files[] = 
$path;
 
  116            } 
catch (Throwable $t) {
 
  118                    "Cron Job \"Clean temp directory\" could not delete " . 
$path 
  119                    . 
"due to the following exception: " . $t->getMessage()
 
  127        $folders = $this->
filesystem->finder()->in([
""]);
 
  128        $folders = $folders->directories();
 
  129        $folders = $folders->date($date);
 
  130        $folders = $folders->sort(fn (
 
  133        ): 
int => strlen(
$a->getPath()) - strlen(
$b->getPath()));
 
  134        $folders = $folders->reverseSorting();
 
  135        $folders = $folders->getIterator();
 
  137        $deleted_folders = [];
 
  140        while ($folders->valid()) {
 
  142                $folder_match = $folders->current();
 
  143                $path = $folder_match->getPath();
 
  144                if ($folder_match->isDir()) {
 
  146                    $deleted_folders[] = 
$path;
 
  149            } 
catch (Throwable $t) {
 
  151                    "Cron Job \"Clean temp directory\" could not delete " . 
$path 
  152                    . 
"due to the following exception: " . $t->getMessage()
 
  158        $num_folders = count($deleted_folders);
 
  159        $num_files = count($deleted_files);
 
  162        $result->setMessage($num_folders . 
" folders and " . $num_files . 
" files have been deleted.");
 
Customizing of pimple-DIC for ILIAS.
 
const SCHEDULE_TYPE_DAILY
@depracated This will be replaced with an ENUM in ILIAS 9
 
Class ilFileSystemCleanTempDirCron.
 
getDefaultScheduleValue()
 
hasAutoActivation()
Is to be activated on "installation", does only work for ILIAS core cron jobs.
 
ILIAS Filesystem Filesystem $filesystem
 
Component logger with individual log levels by component id.
 
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
 
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples