Skip to content

Commit cf00345

Browse files
committed
Component/SystemCheck: contribute cron jobs
1 parent e0f3a6f commit cf00345

3 files changed

Lines changed: 21 additions & 11 deletions

File tree

components/ILIAS/SystemCheck/SystemCheck.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ public function init(
3232
array | \ArrayAccess &$pull,
3333
array | \ArrayAccess &$internal,
3434
): void {
35-
// ...
35+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
36+
new \ilSCCronTrash(
37+
'components\\' . self::class,
38+
$use[\ILIAS\Language\Language::class],
39+
true
40+
);
3641
}
3742
}

components/ILIAS/SystemCheck/classes/class.ilSCCronTrash.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
declare(strict_types=1);
4-
53
/**
64
* This file is part of ILIAS, a powerful learning management system
75
* published by ILIAS open source e-Learning e.V.
@@ -18,6 +16,8 @@
1816
*
1917
*********************************************************************/
2018

19+
declare(strict_types=1);
20+
2121
use ILIAS\Cron\Schedule\CronJobScheduleType;
2222

2323
/**
@@ -26,18 +26,26 @@
2626
*/
2727
class ilSCCronTrash extends ilCronJob
2828
{
29-
protected ilLanguage $lng;
3029
protected ilTree $tree;
3130
protected ilObjectDefinition $objDefinition;
3231

33-
public function __construct()
32+
public function __construct(
33+
string $component,
34+
\ILIAS\Language\Language $lng,
35+
bool $registration = false
36+
) {
37+
parent::__construct($component, $lng);
38+
$this->lng->loadLanguageModule('sysc');
39+
if (!$registration) {
40+
$this->additionalConstruct();
41+
}
42+
}
43+
44+
private function additionalConstruct()
3445
{
3546
global $DIC;
36-
37-
$this->lng = $DIC->language();
3847
$this->tree = $DIC->repositoryTree();
3948
$this->objDefinition = $DIC['objDefinition'];
40-
$this->lng->loadLanguageModule('sysc');
4149
}
4250

4351
public function getId(): string

components/ILIAS/SystemCheck/service.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,5 @@
77
<parent id="adm" max="1">adm</parent>
88
</object>
99
</objects>
10-
<crons>
11-
<cron id="sysc_trash" class="ilSCCronTrash" />
12-
</crons>
1310
<logging />
1411
</service>

0 commit comments

Comments
 (0)