Skip to content

Commit b9c78fd

Browse files
committed
Component/Membership: contribute cron jobs
1 parent 39d4c14 commit b9c78fd

5 files changed

Lines changed: 30 additions & 30 deletions

File tree

components/ILIAS/Membership/Membership.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ public function init(
3232
array | \ArrayAccess &$pull,
3333
array | \ArrayAccess &$internal,
3434
): void {
35-
// ...
35+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
36+
new \ilMembershipCronMinMembers(
37+
'components\\' . self::class,
38+
$use[\ILIAS\Language\Language::class]
39+
);
40+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
41+
new \ilMembershipCronNotifications(
42+
'components\\' . self::class,
43+
$use[\ILIAS\Language\Language::class],
44+
true
45+
);
46+
3647
}
3748
}

components/ILIAS/Membership/classes/Cron/class.ilMembershipCronMinMembers.php

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

3-
declare(strict_types=1);
4-
5-
6-
73
/**
84
* This file is part of ILIAS, a powerful learning management system
95
* published by ILIAS open source e-Learning e.V.
@@ -20,6 +16,8 @@
2016
*
2117
*********************************************************************/
2218

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

2523
/**
@@ -29,15 +27,6 @@
2927
*/
3028
class ilMembershipCronMinMembers extends ilCronJob
3129
{
32-
protected ilLanguage $lng;
33-
34-
public function __construct()
35-
{
36-
global $DIC;
37-
38-
$this->lng = $DIC->language();
39-
}
40-
4130
public function getId(): string
4231
{
4332
return "mem_min_members";

components/ILIAS/Membership/classes/Cron/class.ilMembershipCronNotifications.php

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

3-
declare(strict_types=1);
4-
5-
6-
73
/**
84
* This file is part of ILIAS, a powerful learning management system
95
* published by ILIAS open source e-Learning e.V.
@@ -20,6 +16,8 @@
2016
*
2117
*********************************************************************/
2218

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

2523
/**
@@ -28,16 +26,24 @@
2826
*/
2927
class ilMembershipCronNotifications extends ilCronJob
3028
{
31-
protected ilLanguage $lng;
3229
protected ilDBInterface $db;
3330
protected ilLogger $logger;
3431
protected ilTree $tree;
3532

36-
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()
3745
{
3846
global $DIC;
39-
40-
$this->lng = $DIC->language();
4147
$this->db = $DIC->database();
4248
$this->logger = $DIC->logger()->mmbr();
4349
$this->tree = $DIC->repositoryTree();

components/ILIAS/Membership/classes/Cron/class.ilMembershipCronNotificationsData.php

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

3-
declare(strict_types=1);
4-
5-
6-
73
/**
84
* This file is part of ILIAS, a powerful learning management system
95
* published by ILIAS open source e-Learning e.V.
@@ -20,6 +16,8 @@
2016
*
2117
*********************************************************************/
2218

19+
declare(strict_types=1);
20+
2321
use ILIAS\Notes\Service;
2422

2523
/**

components/ILIAS/Membership/service.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,5 @@
33
<baseclasses>
44
<baseclass name="ilMembershipOverviewGUI" dir="classes" />
55
</baseclasses>
6-
<crons>
7-
<cron id="mem_notification" class="ilMembershipCronNotifications" path="Services/Membership/classes/Cron" />
8-
<cron id="mem_min_members" class="ilMembershipCronMinMembers" path="Services/Membership/classes/Cron" />
9-
</crons>
106
<logging />
117
</service>

0 commit comments

Comments
 (0)