File tree Expand file tree Collapse file tree
components/ILIAS/Filesystem Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,5 +36,12 @@ public function init(
3636 new \ilFileSystemSetupAgent (
3737 $ pull [\ILIAS \Refinery \Factory::class]
3838 );
39+
40+ $ contribute [\ILIAS \Cron \CronJob::class] = static fn () =>
41+ new \ilFileSystemCleanTempDirCron (
42+ 'components \\' . self ::class,
43+ $ use [\ILIAS \Language \Language::class],
44+ true
45+ );
3946 }
4047}
Original file line number Diff line number Diff line change 2828class ilFileSystemCleanTempDirCron extends ilCronJob
2929{
3030 protected \ILIAS \Filesystem \Filesystem $ filesystem ;
31-
32- protected ilLanguage $ language ;
33-
3431 protected ilLogger $ logger ;
3532
36- /**
37- * @inheritDoc
38- */
39- public function __construct ()
33+ public function __construct (
34+ string $ component ,
35+ \ILIAS \Language \Language $ lng ,
36+ bool $ registration = false
37+ ) {
38+ parent ::__construct ($ component , $ lng );
39+ if (!$ registration ) {
40+ $ this ->additionalConstruct ();
41+ }
42+ }
43+
44+ private function additionalConstruct ()
4045 {
4146 /**
4247 * @var $DIC Container
4348 */
4449 global $ DIC ;
45- if ($ DIC ->offsetExists ('lng ' )) {
46- $ this ->language = $ DIC ['lng ' ];
47- }
4850 if ($ DIC ->offsetExists ('filesystem ' )) {
4951 $ this ->filesystem = $ DIC ->filesystem ()->temp ();
5052 }
@@ -128,7 +130,7 @@ public function run(): ilCronJobResult
128130 $ folders = $ this ->filesystem ->finder ()->in (["" ]);
129131 $ folders = $ folders ->directories ();
130132 $ folders = $ folders ->date ($ date );
131- $ folders = $ folders ->sort (fn (
133+ $ folders = $ folders ->sort (fn (
132134 Metadata $ a ,
133135 Metadata $ b
134136 ): int => strlen ($ a ->getPath ()) - strlen ($ b ->getPath ()));
Original file line number Diff line number Diff line change 33 id=" filesys" >
44 <baseclasses >
55 </baseclasses >
6- <crons >
7- <cron id =" file_system_clean_temp_dir" class =" ilFileSystemCleanTempDirCron" />
8- </crons >
96</service >
You can’t perform that action at this time.
0 commit comments