Skip to content

Commit c9544ad

Browse files
committed
Component/Course: contribute cron jobs
1 parent a982c1a commit c9544ad

3 files changed

Lines changed: 14 additions & 16 deletions

File tree

components/ILIAS/Course/Course.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,11 @@ public function init(
4040
new \ilCourseSetupAgent(
4141
$pull[\ILIAS\Refinery\Factory::class]
4242
);
43+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
44+
new \ilTimingsCronReminder(
45+
self::class,
46+
$use[\ILIAS\Language\Language::class],
47+
$use[\ILIAS\Logging\LoggerFactory::class]
48+
);
4349
}
4450
}

components/ILIAS/Course/classes/class.ilTimingsCronReminder.php

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

3-
declare(strict_types=0);
4-
5-
use ILIAS\Cron\Schedule\CronJobScheduleType;
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,10 @@
2016
*
2117
*********************************************************************/
2218

19+
declare(strict_types=0);
20+
21+
use ILIAS\Cron\Schedule\CronJobScheduleType;
22+
2323
class ilTimingsCronReminder extends ilCronJob
2424
{
2525
private static array $objects_information;
@@ -29,21 +29,16 @@ class ilTimingsCronReminder extends ilCronJob
2929
private int $now;
3030

3131
protected ilLogger $log;
32-
protected ilLanguage $lng;
3332
protected ilLanguage $user_lang;
3433
protected ilDBInterface $db;
3534
protected ilObjectDataCache $obj_data_cache;
3635

37-
/**
38-
* Constructor
39-
*/
40-
public function __construct()
36+
public function init(): void
4137
{
42-
global $DIC;
43-
44-
$this->log = $DIC->logger()->crs();
45-
$this->lng = $DIC->language();
4638
$this->lng->loadLanguageModule('crs');
39+
$this->log = $this->logger_factory->getLogger('crs');
40+
41+
global $DIC;
4742
$this->db = $DIC->database();
4843
$this->obj_data_cache = $DIC['ilObjDataCache'];
4944

components/ILIAS/Course/module.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
<event type="raise" id="addSubscriber" />
4242
<event type="raise" id="participantHasPassedCourse" />
4343
</events>
44-
<crons>
45-
<cron id="crs_timings_reminder" class="ilTimingsCronReminder" />
46-
</crons>
4744
<copage>
4845
<pageobject parent_type="lobj" class_name="ilLOPage" directory="classes/Objectives"/>
4946
</copage>

0 commit comments

Comments
 (0)