Skip to content

Commit 2a1c111

Browse files
committed
Component/LTIProvider: contribute cron jobs
1 parent 42414c4 commit 2a1c111

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

components/ILIAS/LTIProvider/LTIProvider.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,12 @@ public function init(
3939

4040
$contribute[Component\Resource\PublicAsset::class] = fn() =>
4141
new Component\Resource\Endpoint($this, "lti.php");
42+
43+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
44+
new \ilLTICronOutcomeService(
45+
'components\\' . self::class,
46+
$use[\ILIAS\Language\Language::class],
47+
true
48+
);
4249
}
4350
}

components/ILIAS/LTIProvider/classes/class.ilLTICronOutcomeService.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,23 @@
2828
*/
2929
class ilLTICronOutcomeService extends ilCronJob
3030
{
31-
private ilLanguage $lng;
3231
private ilCronJobRepository $cronRepo;
3332

34-
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+
$this->lng->loadLanguageModule('lti');
40+
if (!$registration) {
41+
$this->additionalConstruct();
42+
}
43+
}
44+
45+
private function additionalConstruct()
3546
{
3647
global $DIC;
37-
$this->lng = $DIC->language();
38-
$this->lng->loadLanguageModule("lti");
3948
$this->cronRepo = $DIC->cron()->repository();
4049
}
4150

components/ILIAS/LTIProvider/service.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,5 @@
1313
<event type="listen" id="components/ILIAS/User" />
1414

1515
</events>
16-
<crons>
17-
<cron id="lti_outcome" class="ilLTICronOutcomeService" />
18-
</crons>
1916
<logging />
2017
</service>

0 commit comments

Comments
 (0)