Class ilFileSystemCleanTempDirCron.
More...
|
| getId () |
|
| getTitle () |
|
| getDescription () |
|
| hasAutoActivation () |
|
| hasFlexibleSchedule () |
|
| getDefaultScheduleType () |
|
| getDefaultScheduleValue () |
|
| run () |
|
| setDateTimeProvider (?Closure $date_time_provider) |
|
| isDue (?DateTimeImmutable $last_run, ?int $schedule_type, ?int $schedule_value, bool $is_manually_executed=false) |
|
| getScheduleType () |
| Get current schedule type (if flexible) More...
|
|
| getScheduleValue () |
| Get current schedule value (if flexible) More...
|
|
| setSchedule (?int $a_type, ?int $a_value) |
| Update current schedule (if flexible) More...
|
|
| getAllScheduleTypes () |
| Get all available schedule types. More...
|
|
| getScheduleTypesWithValues () |
|
| getValidScheduleTypes () |
| Returns a collection of all valid schedule types for a specific job. More...
|
|
| isManuallyExecutable () |
|
| hasCustomSettings () |
|
| addCustomSettingsToForm (ilPropertyFormGUI $a_form) |
|
| saveCustomSettings (ilPropertyFormGUI $a_form) |
|
| addToExternalSettingsForm (int $a_form_id, array &$a_fields, bool $a_is_active) |
|
| activationWasToggled (ilDBInterface $db, ilSetting $setting, bool $a_currently_active) |
| Important: This method is (also) called from the setup process, where the constructor of an ilCronJob ist NOT executed. More...
|
|
| getId () |
|
| getTitle () |
|
| getDescription () |
|
| hasAutoActivation () |
| Is to be activated on "installation", does only work for ILIAS core cron jobs. More...
|
|
| hasFlexibleSchedule () |
|
| getDefaultScheduleType () |
|
| getDefaultScheduleValue () |
|
| run () |
|
◆ getDefaultScheduleType()
ilFileSystemCleanTempDirCron::getDefaultScheduleType |
( |
| ) |
|
◆ getDefaultScheduleValue()
ilFileSystemCleanTempDirCron::getDefaultScheduleValue |
( |
| ) |
|
◆ getDescription()
ilFileSystemCleanTempDirCron::getDescription |
( |
| ) |
|
◆ getId()
ilFileSystemCleanTempDirCron::getId |
( |
| ) |
|
◆ getTitle()
ilFileSystemCleanTempDirCron::getTitle |
( |
| ) |
|
◆ hasAutoActivation()
ilFileSystemCleanTempDirCron::hasAutoActivation |
( |
| ) |
|
◆ hasFlexibleSchedule()
ilFileSystemCleanTempDirCron::hasFlexibleSchedule |
( |
| ) |
|
◆ initDependencies()
ilFileSystemCleanTempDirCron::initDependencies |
( |
| ) |
|
|
private |
◆ run()
ilFileSystemCleanTempDirCron::run |
( |
| ) |
|
Definition at line 94 of file class.ilFileSystemCleanTempDirCron.php.
References Vendor\Package\$a, Vendor\Package\$b, $path, ILIAS\Repository\filesystem(), ILIAS\Filesystem\DTO\Metadata\getPath(), initDependencies(), ILIAS\Repository\logger(), and ilCronJobResult\STATUS_OK.
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;
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 (
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;
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.");
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
◆ $filesystem
ILIAS Filesystem Filesystem ilFileSystemCleanTempDirCron::$filesystem |
|
protected |
◆ $language
ilLanguage ilFileSystemCleanTempDirCron::$language |
|
protected |
◆ $logger
ilLogger ilFileSystemCleanTempDirCron::$logger |
|
protected |
The documentation for this class was generated from the following file: