Skip to content

Commit 809a5e1

Browse files
committed
Component/COPage: contribute cron jobs
1 parent 473a640 commit 809a5e1

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

components/ILIAS/COPage/COPage.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ public function getTarget(): string
100100
return "assets/js/ilIntLink.js";
101101
}
102102
};
103-
103+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
104+
new \ilCleanCOPageHistoryCronjob(
105+
'components\\' . self::class,
106+
$use[\ILIAS\Language\Language::class],
107+
true
108+
);
104109
}
105110
}

components/ILIAS/COPage/Cron/class.ilCleanCOPageHistoryCronjob.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,22 @@ class ilCleanCOPageHistoryCronjob extends ilCronJob
2828
{
2929
protected HistoryManager $history_manager;
3030
protected ilSetting $settings;
31-
protected ilLanguage $lng;
3231

33-
public function __construct()
32+
33+
public function __construct(
34+
string $component,
35+
\ILIAS\Language\Language $lng,
36+
bool $registration = false
37+
) {
38+
parent::__construct($component, $lng);
39+
if (!$registration) {
40+
$this->additionalConstruct();
41+
}
42+
}
43+
44+
private function additionalConstruct()
3445
{
3546
global $DIC;
36-
37-
$this->lng = $DIC->language();
3847
$this->settings = $DIC->settings();
3948
$this->history_manager = $DIC
4049
->copage()

components/ILIAS/COPage/service.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,4 @@
3838
<pageobject parent_type="stys" class_name="ilPageLayoutPage" directory="Layout/classes"/>
3939
</copage>
4040
<logging />
41-
<crons>
42-
<cron id="copg_history_cleanup" class="ilCleanCOPageHistoryCronjob" path="Services/COPage/Cron" />
43-
</crons>
4441
</service>

0 commit comments

Comments
 (0)