Skip to content

Commit e0f3a6f

Browse files
committed
Component/WOPI: contribute cron jobs
1 parent 6b3a9e0 commit e0f3a6f

3 files changed

Lines changed: 22 additions & 10 deletions

File tree

components/ILIAS/WOPI/WOPI.php

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

4343
$contribute[Component\Resource\PublicAsset::class] = fn() =>
4444
new Component\Resource\ComponentJS($this, "js/dist/wopi.min.js");
45+
46+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
47+
new \ilWOPICrawler(
48+
'components\\' . self::class,
49+
$use[\ILIAS\Language\Language::class],
50+
true
51+
);
4552
}
4653
}

components/ILIAS/WOPI/classes/Cron/class.ilWOPICrawler.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,28 @@
3131
*/
3232
class ilWOPICrawler extends ilCronJob
3333
{
34-
private ilLanguage $language;
3534
private ilSetting $settings;
3635
private Crawler $crawler;
3736
private AppRepository $app_repository;
3837
private ActionRepository $action_repository;
3938

40-
public function __construct()
39+
public function __construct(
40+
string $component,
41+
\ILIAS\Language\Language $lng,
42+
bool $registration = false
43+
) {
44+
parent::__construct($component, $lng);
45+
$this->lng->loadLanguageModule('wopi');
46+
if (!$registration) {
47+
$this->additionalConstruct();
48+
}
49+
}
50+
51+
private function additionalConstruct()
4152
{
4253
global $DIC;
43-
$this->language = $DIC->language();
44-
$this->language->loadLanguageModule('wopi');
4554
$this->settings = $DIC->settings();
4655
$this->crawler = new Crawler();
47-
4856
$this->app_repository = new AppDBRepository($DIC->database());
4957
$this->action_repository = new ActionDBRepository($DIC->database());
5058
}
@@ -56,12 +64,12 @@ public function getId(): string
5664

5765
public function getTitle(): string
5866
{
59-
return $this->language->txt('wopi_crawler_cronjob_title');
67+
return $this->lng->txt('wopi_crawler_cronjob_title');
6068
}
6169

6270
public function getDescription(): string
6371
{
64-
return $this->language->txt('wopi_crawler_cronjob_description');
72+
return $this->lng->txt('wopi_crawler_cronjob_description');
6573
}
6674

6775
public function hasAutoActivation(): bool

components/ILIAS/WOPI/service.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<?xml version = "1.0" encoding = "UTF-8"?>
22
<service xmlns="http://www.w3.org" version="$Id$" id="wopi">
3-
<crons>
4-
<cron id="wopi_crawler" class="ilWOPICrawler"/>
5-
</crons>
63
<logging/>
74
</service>

0 commit comments

Comments
 (0)