Skip to content

Commit 42414c4

Browse files
committed
Component/LDAP: contribute cron jobs
1 parent 61dcec6 commit 42414c4

3 files changed

Lines changed: 20 additions & 9 deletions

File tree

components/ILIAS/LDAP/LDAP.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ public function init(
3333
array | \ArrayAccess &$internal,
3434
): void {
3535
$contribute[\ILIAS\Setup\Agent::class] = static fn() =>
36-
new \ILIAS\LDAP\Setup\Agent();
36+
new \ILIAS\LDAP\Setup\Agent();
37+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
38+
new \ilLDAPCronSynchronization(
39+
'components\\' . self::class,
40+
$use[\ILIAS\Language\Language::class],
41+
true
42+
);
3743
}
3844
}

components/ILIAS/LDAP/classes/class.ilLDAPCronSynchronization.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,28 @@
2626
*/
2727
class ilLDAPCronSynchronization extends ilCronJob
2828
{
29-
private ilLanguage $lng;
3029
private ilLogger $logger;
3130
private ilCronManager $cronManager;
3231

3332
private int $counter = 0;
3433

35-
public function __construct()
34+
public function __construct(
35+
string $component,
36+
\ILIAS\Language\Language $lng,
37+
bool $registration = false
38+
) {
39+
parent::__construct($component, $lng);
40+
$this->lng->loadLanguageModule('ldap');
41+
if (!$registration) {
42+
$this->additionalConstruct();
43+
}
44+
}
45+
46+
private function additionalConstruct()
3647
{
3748
global $DIC;
38-
3949
$this->logger = $DIC->logger()->auth();
4050
$this->cronManager = $DIC->cron()->manager();
41-
$this->lng = $DIC->language();
42-
$this->lng->loadLanguageModule('ldap');
4351
}
4452

4553
public function getId(): string

components/ILIAS/LDAP/service.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,4 @@
66
<pluginslots>
77
<pluginslot id="ldaphk" name="LDAPHook" />
88
</pluginslots>
9-
<crons>
10-
<cron id="ldap_sync" class="ilLDAPCronSynchronization" />
11-
</crons>
129
</service>

0 commit comments

Comments
 (0)