Skip to content

Commit 09811cd

Browse files
committed
Component/StudyProgramme: contribute cron jobs
1 parent 73f89db commit 09811cd

7 files changed

Lines changed: 49 additions & 39 deletions

components/ILIAS/StudyProgramme/StudyProgramme.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,36 @@ public function init(
3838
);
3939
$contribute[Component\Resource\PublicAsset::class] = fn() =>
4040
new Component\Resource\ComponentCSS($this, "css/ilStudyProgramme.css");
41+
42+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
43+
new \ilPrgInvalidateExpiredProgressesCronJob(
44+
self::class,
45+
$use[\ILIAS\Language\Language::class],
46+
$use[\ILIAS\Logging\LoggerFactory::class]
47+
);
48+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
49+
new \ilPrgRestartAssignmentsCronJob(
50+
self::class,
51+
$use[\ILIAS\Language\Language::class],
52+
$use[\ILIAS\Logging\LoggerFactory::class]
53+
);
54+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
55+
new \ilPrgUserNotRestartedCronJob(
56+
self::class,
57+
$use[\ILIAS\Language\Language::class],
58+
$use[\ILIAS\Logging\LoggerFactory::class]
59+
);
60+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
61+
new \ilPrgUserRiskyToFailCronJob(
62+
self::class,
63+
$use[\ILIAS\Language\Language::class],
64+
$use[\ILIAS\Logging\LoggerFactory::class]
65+
);
66+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
67+
new \ilPrgUpdateProgressCronJob(
68+
self::class,
69+
$use[\ILIAS\Language\Language::class],
70+
$use[\ILIAS\Logging\LoggerFactory::class]
71+
);
4172
}
4273
}

components/ILIAS/StudyProgramme/classes/class.ilPrgInvalidateExpiredProgressesCronJob.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,14 @@ class ilPrgInvalidateExpiredProgressesCronJob extends ilCronJob
3232
private const ID = 'prg_invalidate_expired_progresses';
3333

3434
protected ilComponentLogger $log;
35-
protected ilLanguage $lng;
3635
protected ilPRGAssignmentDBRepository $assignment_repo;
3736
protected ilStudyProgrammeSettingsDBRepository $settings_repo;
3837

39-
public function __construct()
38+
39+
public function init(): void
4040
{
41-
global $DIC;
42-
$this->log = $DIC['ilLog'];
43-
$this->lng = $DIC['lng'];
4441
$this->lng->loadLanguageModule('prg');
42+
$this->log = $this->logger_factory->getLogger('prg');
4543

4644
$dic = ilStudyProgrammeDIC::dic();
4745
$this->assignment_repo = $dic['repo.assignment'];

components/ILIAS/StudyProgramme/classes/class.ilPrgRestartAssignmentsCronJob.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,15 @@ class ilPrgRestartAssignmentsCronJob extends ilCronJob
3131
private const ACTING_USR_ID = ilPRGAssignment::AUTO_ASSIGNED_BY_RESTART;
3232

3333
protected ilComponentLogger $log;
34-
protected ilLanguage $lng;
3534
protected ilPRGAssignmentDBRepository $assignment_repo;
3635
protected ilPrgCronJobAdapter $adapter;
3736

3837
protected array $prgs = [];
3938

40-
public function __construct()
39+
public function init(): void
4140
{
42-
global $DIC;
43-
$this->log = $DIC['ilLog'];
44-
$this->lng = $DIC['lng'];
4541
$this->lng->loadLanguageModule('prg');
42+
$this->log = $this->logger_factory->getLogger('prg');
4643

4744
$dic = ilStudyProgrammeDIC::dic();
4845
$this->assignment_repo = $dic['repo.assignment'];

components/ILIAS/StudyProgramme/classes/class.ilPrgUpdateProgressCronJob.php

Lines changed: 3 additions & 6 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
/**
@@ -29,15 +29,12 @@ class ilPrgUpdateProgressCronJob extends ilCronJob
2929
private const ID = 'prg_update_progress';
3030

3131
protected Pimple\Container $dic;
32-
protected ilLanguage $lng;
3332
protected ilStudyProgrammeSettingsDBRepository $settings_repo;
3433
protected ilPRGAssignmentDBRepository $assignment_repo;
3534
protected int $acting_user_id;
3635

37-
public function __construct()
36+
public function init(): void
3837
{
39-
global $DIC;
40-
$this->lng = $DIC['lng'];
4138
$this->lng->loadLanguageModule('prg');
4239

4340
$dic = ilStudyProgrammeDIC::dic();

components/ILIAS/StudyProgramme/classes/class.ilPrgUserNotRestartedCronJob.php

Lines changed: 4 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
/**
@@ -28,16 +28,13 @@ class ilPrgUserNotRestartedCronJob extends ilCronJob
2828
private const ID = 'prg_user_not_restarted';
2929

3030
protected ilComponentLogger $log;
31-
protected ilLanguage $lng;
3231
protected ilPRGAssignmentDBRepository $assignment_repo;
3332
protected ilPrgCronJobAdapter $adapter;
3433

35-
public function __construct()
34+
public function init(): void
3635
{
37-
global $DIC;
38-
$this->log = $DIC['ilLog'];
39-
$this->lng = $DIC['lng'];
4036
$this->lng->loadLanguageModule('prg');
37+
$this->log = $this->logger_factory->getLogger('prg');
4138

4239
$dic = ilStudyProgrammeDIC::dic();
4340
$this->assignment_repo = $dic['repo.assignment'];

components/ILIAS/StudyProgramme/classes/class.ilPrgUserRiskyToFailCronJob.php

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

3-
declare(strict_types=1);
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,21 +16,22 @@
2016
*
2117
*********************************************************************/
2218

19+
declare(strict_types=1);
20+
21+
use ILIAS\Cron\Schedule\CronJobScheduleType;
22+
2323
class ilPrgUserRiskyToFailCronJob extends ilCronJob
2424
{
2525
private const ID = 'prg_user_risky_to_fail';
2626

2727
protected ilComponentLogger $log;
28-
protected ilLanguage $lng;
2928
protected ilPRGAssignmentDBRepository $assignment_repo;
3029
protected ilPrgCronJobAdapter $adapter;
3130

32-
public function __construct()
31+
public function init(): void
3332
{
34-
global $DIC;
35-
$this->log = $DIC['ilLog'];
36-
$this->lng = $DIC['lng'];
3733
$this->lng->loadLanguageModule('prg');
34+
$this->log = $this->logger_factory->getLogger('prg');
3835

3936
$dic = ilStudyProgrammeDIC::dic();
4037
$this->assignment_repo = $dic['repo.assignment'];

components/ILIAS/StudyProgramme/module.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,6 @@
4343
<event type="raise" id="userReAssigned" />
4444
<event type="raise" id="userSuccessful" />
4545
</events>
46-
<crons>
47-
<cron id="prg_invalidate_expired_progresses" class="ilPrgInvalidateExpiredProgressesCronJob" />
48-
<cron id="prg_restart_assignments_temporal_progress" class="ilPrgRestartAssignmentsCronJob" />
49-
<cron id="prg_user_not_restarted" class="ilPrgUserNotRestartedCronJob" />
50-
<cron id="prg_user_risky_to_fail" class="ilPrgUserRiskyToFailCronJob" />
51-
<cron id="prg_update_progress" class="ilPrgUpdateProgressCronJob" />
52-
</crons>
5346
<mailtemplates>
5447
<context id="prg_context_manual" class="ilStudyProgrammeMailTemplateContext" />
5548
</mailtemplates>

0 commit comments

Comments
 (0)