Skip to content

Commit 39d4c14

Browse files
committed
Component/Search: contribute cron jobs
1 parent 972de1e commit 39d4c14

3 files changed

Lines changed: 34 additions & 9 deletions

File tree

components/ILIAS/Search/Search.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,11 @@ public function init(
3636
new Component\Resource\ComponentJS($this, "SearchMainMenu.js");
3737
$contribute[Component\Resource\PublicAsset::class] = fn() =>
3838
new Component\Resource\ComponentJS($this, "Search.js");
39+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
40+
new \ilLuceneIndexer(
41+
'components\\' . self::class,
42+
$use[\ILIAS\Language\Language::class],
43+
true
44+
);
3945
}
4046
}

components/ILIAS/Search/classes/Lucene/class.ilLuceneIndexer.php

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

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+
*********************************************************************/
18+
319
declare(strict_types=1);
4-
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
520

621
use ILIAS\Cron\Schedule\CronJobScheduleType;
722

@@ -16,15 +31,22 @@
1631
class ilLuceneIndexer extends ilCronJob
1732
{
1833
protected int $timeout = 60;
19-
20-
protected ilLanguage $lng;
2134
protected ilSetting $setting;
2235

23-
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+
if (!$registration) {
43+
$this->additionalConstruct();
44+
}
45+
}
46+
47+
private function additionalConstruct()
2448
{
2549
global $DIC;
26-
27-
$this->lng = $DIC->language();
2850
$this->setting = $DIC->settings();
2951
}
3052

components/ILIAS/Search/service.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,5 @@
1414
<event type="listen" id="components/ILIAS/Search" />
1515
<event type="listen" id="components/ILIAS/Object" />
1616
</events>
17-
<crons>
18-
<cron id="src_lucene_indexer" class="ilLuceneIndexer" path="Services/Search/classes/Lucene/" />
19-
</crons>
2017
<logging />
2118
</service>

0 commit comments

Comments
 (0)