Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b7c4f6d
Component/Cron: init cron jobs via SetupAgent and Component's seek
nhaagen Dec 11, 2024
a84b795
Component/Cron: remove ilCronDefinitionProcessor
nhaagen Dec 13, 2024
3a3bd3e
Component/User: contribute cron jobs
nhaagen Dec 16, 2024
44de060
Component/Authentication: contribute cron
nhaagen Jan 2, 2025
3cce637
Component/BookingManager: contribute cron jobs
nhaagen Dec 16, 2024
b173916
Component/Certificate: contribute cron jobs
nhaagen Dec 16, 2024
60c20b7
Component/COPage: contribute cron jobs
nhaagen Dec 16, 2024
2b80281
Component/Calendar: contribute cron jobs
nhaagen Dec 16, 2024
f561912
Component/WebServices: contribute cron jobs
nhaagen Dec 16, 2024
5068334
Component/Test: contribute cron jobs
nhaagen Dec 16, 2024
1fc6de6
Component/MetaData: contribute cron jobs
nhaagen Dec 16, 2024
6dd58f6
Component/OrgUnits: contribute cron jobs
nhaagen Dec 16, 2024
3762f77
Component/Exercise: contribute cron jobs
nhaagen Dec 16, 2024
30e7653
Component/Tracking: contribute cron jobs
nhaagen Dec 16, 2024
7b35070
Component/StudyProgramme: contribute cron jobs
nhaagen Dec 16, 2024
1c46f37
Component/Search: contribute cron jobs
nhaagen Dec 16, 2024
f3d8747
Component/Membership: contribute cron jobs
nhaagen Dec 16, 2024
b0e6a03
Component/Forum: contribute cron jobs
nhaagen Dec 16, 2024
70c484b
Component/Mail: contribute cron jobs
nhaagen Dec 16, 2024
72dc8b6
Component/LDAP: contribute cron jobs
nhaagen Dec 16, 2024
3b01caf
Component/LTIProvider: contribute cron jobs
nhaagen Dec 16, 2024
58071bd
Component/Logging: contribute cron jobs
nhaagen Dec 16, 2024
32f9d4c
Component/WOPI: contribute cron jobs
nhaagen Dec 16, 2024
43f4dfa
Component/SystemCheck: contribute cron jobs
nhaagen Dec 16, 2024
74668e6
Component/Survey: contribute cron jobs
nhaagen Dec 16, 2024
111ef66
Component/Skill: contribute cron jobs
nhaagen Dec 16, 2024
eab7e9f
Component/Filesystem: contribute cron jobs
nhaagen Dec 16, 2024
ff226c1
Component/Course: contribute cron jobs
nhaagen Dec 16, 2024
1771a88
Component/CmiXapi: contribute cron jobs
nhaagen Dec 16, 2024
dc7210b
fix copyrights
nhaagen Dec 16, 2024
31ba85b
Cron: update readme
nhaagen Dec 16, 2024
f7aa237
Cron: init with CronRegistry and LoggerFactory
nhaagen Jan 2, 2025
4cd5e61
Cron: initialisation
nhaagen Jan 2, 2025
a290a96
(Cron)/Logging: provide logger factory
nhaagen Jan 2, 2025
f63345b
Cron: ilCronJobEntities is more of array than iterator
nhaagen Jan 2, 2025
4eca2af
Cron: use ilSetupLanguage in Objective
nhaagen Jan 3, 2025
1e23281
Cron: update Readme
nhaagen Jan 3, 2025
ce5cac9
Cron: use component bootstrap/entry point for runner
nhaagen Jan 3, 2025
dbf4c54
Cron: minor adjustments
nhaagen Mar 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cli/cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@

declare(strict_types=1);

chdir(__DIR__);
chdir('..');
require_once __DIR__ . '/../vendor/composer/vendor/autoload.php';
require_once __DIR__ . '/../artifacts/bootstrap_default.php';

require_once './vendor/composer/vendor/autoload.php';
ilContext::init(ilContext::CONTEXT_CRON);

entry_point('ILIAS Legacy Initialisation Adapter');

$cron = new ILIAS\Cron\CLI\App(
new ILIAS\Cron\CLI\Commands\RunActiveJobsCommand()
Expand Down
2 changes: 1 addition & 1 deletion cli/hello_world.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
*********************************************************************/

require_once(__DIR__ . "/../artifacts/bootstrap.php");
require_once(__DIR__ . "/../artifacts/bootstrap_setup.php");

// This calls a simple entrypoint, for testing and documentation purpose. This
// should just print a simple hello and will work when bootstrapping works.
Expand Down
7 changes: 7 additions & 0 deletions components/ILIAS/Authentication/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,12 @@ public function offsetUnset(mixed $offset): void
new Component\Resource\Endpoint($this, "sessioncheck.php");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "session_reminder.js");

$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
new \ilAuthDestroyExpiredSessionsCron(
self::class,
$use[\ILIAS\Language\Language::class],
$use[\ILIAS\Logging\LoggerFactory::class]
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@

class ilAuthDestroyExpiredSessionsCron extends ilCronJob
{
protected ilLanguage $lng;

public function __construct()
public function init(): void
{
global $DIC;

$this->lng = $DIC->language();
$this->lng->loadLanguageModule('auth');
}

Expand Down
3 changes: 0 additions & 3 deletions components/ILIAS/Authentication/service.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,4 @@
<pluginslot id="authhk" name="AuthenticationHook" />
</pluginslots>
<logging />
<crons>
<cron id="auth_destroy_expired_sessions" class="ilAuthDestroyExpiredSessionsCron" />
</crons>
</service>
13 changes: 13 additions & 0 deletions components/ILIAS/BookingManager/BookingManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,18 @@ public function init(

$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "ScheduleInput.js");

$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
new \ilBookCronNotification(
self::class,
$use[\ILIAS\Language\Language::class],
$use[\ILIAS\Logging\LoggerFactory::class]
);
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
new \ilBookingPrefBookCron(
self::class,
$use[\ILIAS\Language\Language::class],
$use[\ILIAS\Logging\LoggerFactory::class]
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@
class ilBookCronNotification extends ilCronJob
{
protected \ILIAS\BookingManager\InternalRepoService $repo;
protected ilLanguage $lng;
protected ilLogger $book_log;

public function __construct()
public function init(): void
{
global $DIC;

$this->lng = $DIC->language();
$this->lng->loadLanguageModule('dateplaner');
$this->lng->loadLanguageModule('book');

global $DIC;
$this->book_log = ilLoggerFactory::getLogger("book");
$this->repo = $DIC->bookingManager()
->internal()
Expand All @@ -47,18 +46,12 @@ public function getId(): string

public function getTitle(): string
{
$lng = $this->lng;

$lng->loadLanguageModule("book");
return $lng->txt("book_notification");
return $this->lng->txt("book_notification");
}

public function getDescription(): string
{
$lng = $this->lng;

$lng->loadLanguageModule("book");
return $lng->txt("book_notification_info");
return $this->lng->txt("book_notification_info");
}

public function getDefaultScheduleType(): CronJobScheduleType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,9 @@
*/
class ilBookingPrefBookCron extends ilCronJob
{
protected ilLanguage $lng;

public function __construct()
public function init(): void
{
global $DIC;

$this->lng = $DIC->language();
$this->lng->loadLanguageModule('book');
}

public function getId(): string
Expand Down
4 changes: 0 additions & 4 deletions components/ILIAS/BookingManager/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,5 @@
<web_access_checker>
<secure_path path="ilBookingManager" checking-class="ilObjBookingPoolAccess"/>
</web_access_checker>
<crons>
<cron id="book_notification" class="ilBookCronNotification" />
<cron id="book_pref_book" class="ilBookingPrefBookCron" />
</crons>
<logging />
</module>
7 changes: 6 additions & 1 deletion components/ILIAS/COPage/COPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ public function getTarget(): string
return "assets/js/ilIntLink.js";
}
};

$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
new \ilCleanCOPageHistoryCronjob(
self::class,
$use[\ILIAS\Language\Language::class],
$use[\ILIAS\Logging\LoggerFactory::class]
);
}
}
21 changes: 7 additions & 14 deletions components/ILIAS/COPage/Cron/class.ilCleanCOPageHistoryCronjob.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=1);

use ILIAS\COPage\History\HistoryManager;
use ILIAS\Cron\Schedule\CronJobScheduleType;

Expand All @@ -28,13 +28,12 @@ class ilCleanCOPageHistoryCronjob extends ilCronJob
{
protected HistoryManager $history_manager;
protected ilSetting $settings;
protected ilLanguage $lng;

public function __construct()
public function init(): void
{
global $DIC;
$this->lng->loadLanguageModule("copg");

$this->lng = $DIC->language();
global $DIC;
$this->settings = $DIC->settings();
$this->history_manager = $DIC
->copage()
Expand All @@ -50,18 +49,12 @@ public function getId(): string

public function getTitle(): string
{
$lng = $this->lng;

$lng->loadLanguageModule("copg");
return $lng->txt("copg_history_cleanup_cron");
return $this->lng->txt("copg_history_cleanup_cron");
}

public function getDescription(): string
{
$lng = $this->lng;

$lng->loadLanguageModule("copg");
return $lng->txt("copg_history_cleanup_cron_info");
return $this->lng->txt("copg_history_cleanup_cron_info");
}

public function getDefaultScheduleType(): CronJobScheduleType
Expand Down
3 changes: 0 additions & 3 deletions components/ILIAS/COPage/service.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,4 @@
<pageobject parent_type="stys" class_name="ilPageLayoutPage" directory="Layout/classes"/>
</copage>
<logging />
<crons>
<cron id="copg_history_cleanup" class="ilCleanCOPageHistoryCronjob" path="Services/COPage/Cron" />
</crons>
</service>
12 changes: 12 additions & 0 deletions components/ILIAS/Calendar/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,17 @@ public function init(
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\NodeModule("eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js");
*/
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
new \ilCalendarCronRemoteReader(
self::class,
$use[\ILIAS\Language\Language::class],
$use[\ILIAS\Logging\LoggerFactory::class]
);
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
new \ilConsultationHourCron(
self::class,
$use[\ILIAS\Language\Language::class],
$use[\ILIAS\Logging\LoggerFactory::class]
);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=1);

use ILIAS\Cron\Schedule\CronJobScheduleType;

/**
Expand All @@ -26,16 +26,14 @@
*/
class ilConsultationHourCron extends ilCronJob
{
protected ilLanguage $lng;
protected ilDBInterface $db;
protected ilSetting $setting;

public function __construct()
public function init(): void
{
global $DIC;

$this->lng = $DIC->language();
$this->lng->loadLanguageModule('dateplaner');

global $DIC;
$this->db = $DIC->database();
$this->setting = $DIC->settings();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ class ilCalendarCronRemoteReader extends ilCronJob
{
private const DEFAULT_SYNC_HOURS = 1;

private ilLanguage $lng;
private ilLogger $logger;

private ?ilCalendarSettings $calendar_settings = null;

public function __construct()
public function init(): void
{
$this->lng->loadLanguageModule('dateplaner');
global $DIC;

$this->lng = $DIC->language();
$this->logger = $DIC->logger()->cal();
$this->calendar_settings = ilCalendarSettings::_getInstance();
}
Expand All @@ -45,13 +42,11 @@ public function getId(): string

public function getTitle(): string
{
$this->lng->loadLanguageModule('dateplaner');
return $this->lng->txt('cal_cronjob_remote_title');
}

public function getDescription(): string
{
$this->lng->loadLanguageModule('dateplaner');
return $this->lng->txt('cal_cronjob_remote_description');
}

Expand Down Expand Up @@ -106,8 +101,8 @@ public function run(): ilCronJobResult
$reader->setUser($remoteCalendar->getRemoteUser());
$reader->setPass($remoteCalendar->getRemotePass());
try {
$reader->read();
$reader->import($remoteCalendar);
$reader->read();
$reader->import($remoteCalendar);
} catch (Exception $e) {
$this->logger->warning('Remote Calendar: ' . $remoteCalendar->getCategoryID());
$this->logger->warning('Reading remote calendar failed with message: ' . $e->getMessage());
Expand Down
4 changes: 0 additions & 4 deletions components/ILIAS/Calendar/service.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
<event type="listen" id="components/ILIAS/Exercise" />
<event type="listen" id="components/ILIAS/EmployeeTalk" />
</events>
<crons>
<cron id="cal_remote_reader" class="ilCalendarCronRemoteReader" path="Services/Calendar/classes/Cron/" />
<cron id="cal_consultation" class="ilConsultationHourCron" path="Services/Calendar/classes/ConsultationHours/" />
</crons>
<pluginslots>
<pluginslot id="capm" name="AppointmentCustomModal" />
<pluginslot id="capg" name="AppointmentCustomGrid" />
Expand Down
7 changes: 7 additions & 0 deletions components/ILIAS/Certificate/Certificate.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,12 @@ public function init(
new \ilCertificatSetupAgent(
$pull[\ILIAS\Refinery\Factory::class]
);

$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
new \ilCertificateCron(
'components\\' . self::class,
$use[\ILIAS\Language\Language::class],
$use[\ILIAS\Logging\LoggerFactory::class]
);
}
}
22 changes: 7 additions & 15 deletions components/ILIAS/Certificate/classes/class.ilCertificateCron.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,23 @@
*/
class ilCertificateCron extends ilCronJob
{
protected ?ilLanguage $lng;
private ?Container $dic;
private ?Container $dic = null;

public function __construct(
string $component,
\ILIAS\Language\Language $lng,
\ILIAS\Logging\LoggerFactory $logger_factory,
private ?ilCertificateQueueRepository $queueRepository = null,
private ?ilCertificateTemplateRepository $templateRepository = null,
private ?ilUserCertificateRepository $userRepository = null,
private ?ilCertificateValueReplacement $valueReplacement = null,
private ?ilLogger $logger = null,
?Container $dic = null,
?ilLanguage $language = null,
private ?ilCertificateObjectHelper $objectHelper = null,
private ?ilSetting $settings = null,
private ?ilCronManager $cronManager = null,
) {
if (null === $dic) {
global $DIC;
$dic = $DIC;
}
$this->dic = $dic;

if ($dic && isset($dic['lng'])) {
$language = $dic->language();
$language->loadLanguageModule('certificate');
}

$this->lng = $language;
parent::__construct($component, $lng, $logger_factory);
}

public function getTitle(): string
Expand All @@ -67,6 +57,8 @@ public function getDescription(): string

public function init(): void
{
$this->lng->loadLanguageModule('certificate');

if (null === $this->dic) {
global $DIC;
$this->dic = $DIC;
Expand Down
Loading