Skip to content

Commit 9f3aae3

Browse files
committed
Component/WebServices: contribute cron jobs
1 parent c2d00b3 commit 9f3aae3

3 files changed

Lines changed: 36 additions & 10 deletions

File tree

components/ILIAS/WebServices/WebServices.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,13 @@ public function init(
4141
new \ilECSAgent(
4242
$pull[\ILIAS\Refinery\Factory::class]
4343
);
44+
45+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
46+
new \ilCronEcsTaskScheduler(
47+
'components\\' . self::class,
48+
$use[\ILIAS\Language\Language::class],
49+
true
50+
);
51+
4452
}
4553
}

components/ILIAS/WebServices/classes/class.ilCronEcsTaskScheduler.php

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

3-
/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3+
/**
4+
* This file is part of ILIAS, a powerful learning management system
5+
* published by ILIAS open source e-Learning e.V.
6+
*
7+
* ILIAS is licensed with the GPL-3.0,
8+
* see https://www.gnu.org/licenses/gpl-3.0.en.html
9+
* You should have received a copy of said license along with the
10+
* source code, too.
11+
*
12+
* If this is not the case or you just want to try ILIAS, you'll find
13+
* us at:
14+
* https://www.ilias.de
15+
* https://github.com/ILIAS-eLearning
16+
*
17+
*********************************************************************/
418

519
use ILIAS\Cron\Schedule\CronJobScheduleType;
620

@@ -16,17 +30,24 @@ class ilCronEcsTaskScheduler extends \ilCronJob
1630
public const DEFAULT_SCHEDULE_VALUE = 1;
1731

1832
private ilLogger $logger;
19-
private ilLanguage $lng;
2033
private ilCronJobResult $result;
2134

22-
public function __construct()
35+
public function __construct(
36+
string $component,
37+
\ILIAS\Language\Language $lng,
38+
bool $registration = false
39+
) {
40+
parent::__construct($component, $lng);
41+
$this->lng->loadLanguageModule('ecs');
42+
if (!$registration) {
43+
$this->additionalConstruct();
44+
}
45+
}
46+
47+
private function additionalConstruct()
2348
{
2449
global $DIC;
25-
2650
$this->logger = $DIC->logger()->wsrv();
27-
$this->lng = $DIC->language();
28-
$this->lng->loadLanguageModule('ecs');
29-
3051
$this->result = new \ilCronJobResult();
3152
}
3253

components/ILIAS/WebServices/service.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
<event type="listen" id="components/ILIAS/Authentication" component="Services/WebServices/ECS" />
1616
<event type="raise" id="newEcsEvent" />
1717
</events>
18-
<crons>
19-
<cron id="ecs_task_handler" class="ilCronEcsTaskScheduler" />
20-
</crons>
2118
<pluginslots>
2219
<pluginslot id="soaphk" name="SoapHook" />
2320
</pluginslots>

0 commit comments

Comments
 (0)