Skip to content

Commit 57f57ea

Browse files
committed
Component/Tracking: contribute cron jobs
1 parent 4add4b1 commit 57f57ea

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

components/ILIAS/Tracking/Tracking.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,11 @@ public function init(
3939
$contribute[SetupAgentInterface::class] = fn() => new SetupAgent($pull[Refinery::class]);
4040
$contribute[Component\Resource\PublicAsset::class] = fn() =>
4141
new Component\Resource\ComponentJS($this, "ilObjStat.js");
42+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
43+
new \ilLPCronObjectStatistics(
44+
'components\\' . self::class,
45+
$use[\ILIAS\Language\Language::class],
46+
true
47+
);
4248
}
4349
}

components/ILIAS/Tracking/classes/class.ilLPCronObjectStatistics.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,27 @@
2828
class ilLPCronObjectStatistics extends ilCronJob
2929
{
3030
protected int $date = 0;
31-
32-
protected ilLanguage $lng;
3331
protected ilDBInterface $db;
3432
protected ilTree $tree;
3533
protected ilLogger $logger;
3634
protected ilCronManager $cron_manager;
3735

38-
public function __construct()
36+
public function __construct(
37+
string $component,
38+
\ILIAS\Language\Language $lng,
39+
bool $registration = false
40+
) {
41+
parent::__construct($component, $lng);
42+
$this->lng->loadLanguageModule('trac');
43+
if (!$registration) {
44+
$this->additionalConstruct();
45+
}
46+
}
47+
48+
private function additionalConstruct()
3949
{
4050
global $DIC;
41-
4251
$this->logger = $DIC->logger()->trac();
43-
$this->lng = $DIC->language();
44-
$this->lng->loadLanguageModule("trac");
4552
$this->db = $DIC->database();
4653
$this->tree = $DIC->repositoryTree();
4754
$this->cron_manager = $DIC->cron()->manager();

components/ILIAS/Tracking/service.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,5 @@
1717
<event type="listen" id="components/ILIAS/Group" />
1818
<event type="listen" id="components/ILIAS/LearningSequence" />
1919
</events>
20-
<crons>
21-
<cron id="lp_object_statistics" class="ilLPCronObjectStatistics" />
22-
</crons>
2320
<logging />
2421
</service>

0 commit comments

Comments
 (0)