diff --git a/cli/cron.php b/cli/cron.php
index a54536e3c6e1..97a357d732a7 100755
--- a/cli/cron.php
+++ b/cli/cron.php
@@ -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()
diff --git a/cli/hello_world.php b/cli/hello_world.php
index 6dfa4b3b403d..dc3c32f710c9 100644
--- a/cli/hello_world.php
+++ b/cli/hello_world.php
@@ -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.
diff --git a/components/ILIAS/Authentication/Authentication.php b/components/ILIAS/Authentication/Authentication.php
index 8390519017fc..b9f703c4fb7a 100644
--- a/components/ILIAS/Authentication/Authentication.php
+++ b/components/ILIAS/Authentication/Authentication.php
@@ -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]
+ );
}
}
diff --git a/components/ILIAS/Authentication/classes/Cron/class.ilAuthDestroyExpiredSessionsCron.php b/components/ILIAS/Authentication/classes/Cron/class.ilAuthDestroyExpiredSessionsCron.php
index 2b9c6135b7d2..9132c25a4a38 100755
--- a/components/ILIAS/Authentication/classes/Cron/class.ilAuthDestroyExpiredSessionsCron.php
+++ b/components/ILIAS/Authentication/classes/Cron/class.ilAuthDestroyExpiredSessionsCron.php
@@ -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');
}
diff --git a/components/ILIAS/Authentication/service.xml b/components/ILIAS/Authentication/service.xml
index ab8ba0262925..78b703afe9b3 100755
--- a/components/ILIAS/Authentication/service.xml
+++ b/components/ILIAS/Authentication/service.xml
@@ -23,7 +23,4 @@
-
-
-
diff --git a/components/ILIAS/BookingManager/BookingManager.php b/components/ILIAS/BookingManager/BookingManager.php
index f49fde78f512..aee12e570ebd 100644
--- a/components/ILIAS/BookingManager/BookingManager.php
+++ b/components/ILIAS/BookingManager/BookingManager.php
@@ -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]
+ );
}
}
diff --git a/components/ILIAS/BookingManager/classes/class.ilBookCronNotification.php b/components/ILIAS/BookingManager/classes/class.ilBookCronNotification.php
index cb8f479f8e2e..15686f1bba37 100755
--- a/components/ILIAS/BookingManager/classes/class.ilBookCronNotification.php
+++ b/components/ILIAS/BookingManager/classes/class.ilBookCronNotification.php
@@ -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()
@@ -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
diff --git a/components/ILIAS/BookingManager/classes/class.ilBookingPrefBookCron.php b/components/ILIAS/BookingManager/classes/class.ilBookingPrefBookCron.php
index eaa67ecf2c99..778ed05a98b1 100755
--- a/components/ILIAS/BookingManager/classes/class.ilBookingPrefBookCron.php
+++ b/components/ILIAS/BookingManager/classes/class.ilBookingPrefBookCron.php
@@ -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
diff --git a/components/ILIAS/BookingManager/module.xml b/components/ILIAS/BookingManager/module.xml
index a5f775ba7db2..41226d366bc1 100755
--- a/components/ILIAS/BookingManager/module.xml
+++ b/components/ILIAS/BookingManager/module.xml
@@ -21,9 +21,5 @@
-
-
-
-
diff --git a/components/ILIAS/COPage/COPage.php b/components/ILIAS/COPage/COPage.php
index 650460610472..b0d1040f2fb9 100644
--- a/components/ILIAS/COPage/COPage.php
+++ b/components/ILIAS/COPage/COPage.php
@@ -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]
+ );
}
}
diff --git a/components/ILIAS/COPage/Cron/class.ilCleanCOPageHistoryCronjob.php b/components/ILIAS/COPage/Cron/class.ilCleanCOPageHistoryCronjob.php
index 67e34831b2db..496343f1ed06 100755
--- a/components/ILIAS/COPage/Cron/class.ilCleanCOPageHistoryCronjob.php
+++ b/components/ILIAS/COPage/Cron/class.ilCleanCOPageHistoryCronjob.php
@@ -1,7 +1,5 @@
lng->loadLanguageModule("copg");
- $this->lng = $DIC->language();
+ global $DIC;
$this->settings = $DIC->settings();
$this->history_manager = $DIC
->copage()
@@ -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
diff --git a/components/ILIAS/COPage/service.xml b/components/ILIAS/COPage/service.xml
index 63036614d25c..865f5c4c2ba5 100755
--- a/components/ILIAS/COPage/service.xml
+++ b/components/ILIAS/COPage/service.xml
@@ -38,7 +38,4 @@
-
-
-
diff --git a/components/ILIAS/Calendar/Calendar.php b/components/ILIAS/Calendar/Calendar.php
index 77c3b176c694..9f8423742576 100644
--- a/components/ILIAS/Calendar/Calendar.php
+++ b/components/ILIAS/Calendar/Calendar.php
@@ -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]
+ );
}
}
diff --git a/components/ILIAS/Calendar/classes/ConsultationHours/class.ilConsultationHourCron.php b/components/ILIAS/Calendar/classes/ConsultationHours/class.ilConsultationHourCron.php
index e942060b69a4..cf9bcd007ba0 100755
--- a/components/ILIAS/Calendar/classes/ConsultationHours/class.ilConsultationHourCron.php
+++ b/components/ILIAS/Calendar/classes/ConsultationHours/class.ilConsultationHourCron.php
@@ -1,7 +1,5 @@
lng = $DIC->language();
$this->lng->loadLanguageModule('dateplaner');
+
+ global $DIC;
$this->db = $DIC->database();
$this->setting = $DIC->settings();
}
diff --git a/components/ILIAS/Calendar/classes/Cron/class.ilCalendarCronRemoteReader.php b/components/ILIAS/Calendar/classes/Cron/class.ilCalendarCronRemoteReader.php
index 91ff6df4a77e..9f63e0c5245d 100755
--- a/components/ILIAS/Calendar/classes/Cron/class.ilCalendarCronRemoteReader.php
+++ b/components/ILIAS/Calendar/classes/Cron/class.ilCalendarCronRemoteReader.php
@@ -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();
}
@@ -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');
}
@@ -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());
diff --git a/components/ILIAS/Calendar/service.xml b/components/ILIAS/Calendar/service.xml
index cdb7cda6246a..3bf74812cc04 100755
--- a/components/ILIAS/Calendar/service.xml
+++ b/components/ILIAS/Calendar/service.xml
@@ -16,10 +16,6 @@
-
-
-
-
diff --git a/components/ILIAS/Certificate/Certificate.php b/components/ILIAS/Certificate/Certificate.php
index 952bd54700c7..1feff4b6f99c 100644
--- a/components/ILIAS/Certificate/Certificate.php
+++ b/components/ILIAS/Certificate/Certificate.php
@@ -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]
+ );
}
}
diff --git a/components/ILIAS/Certificate/classes/class.ilCertificateCron.php b/components/ILIAS/Certificate/classes/class.ilCertificateCron.php
index b748b7d65815..427fa3046332 100755
--- a/components/ILIAS/Certificate/classes/class.ilCertificateCron.php
+++ b/components/ILIAS/Certificate/classes/class.ilCertificateCron.php
@@ -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
@@ -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;
diff --git a/components/ILIAS/Certificate/service.xml b/components/ILIAS/Certificate/service.xml
index 430437ec71d9..7f7b5c2dfebd 100755
--- a/components/ILIAS/Certificate/service.xml
+++ b/components/ILIAS/Certificate/service.xml
@@ -14,8 +14,5 @@
-
-
-
diff --git a/components/ILIAS/Certificate/tests/ilCertificateCronTest.php b/components/ILIAS/Certificate/tests/ilCertificateCronTest.php
index 1d538ee0df50..06e27c5b6fa6 100755
--- a/components/ILIAS/Certificate/tests/ilCertificateCronTest.php
+++ b/components/ILIAS/Certificate/tests/ilCertificateCronTest.php
@@ -19,6 +19,7 @@
declare(strict_types=1);
use ILIAS\Cron\Schedule\CronJobScheduleType;
+use ILIAS\Logging\LoggerFactory;
/**
* @author Niels Theen
@@ -71,14 +72,20 @@ public function testGetTitle(): void
$dic['lng'] = $languageMock;
+ $logger_factory = $this->getMockBuilder(LoggerFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
$cron = new ilCertificateCron(
+ 'components\ILIAS\Certificate',
+ $languageMock,
+ $logger_factory,
$queueRepository,
$templateRepository,
$userRepository,
$valueReplacement,
$logger,
- $dic,
- $languageMock
+ $dic
);
$title = $cron->getTitle();
@@ -132,14 +139,20 @@ public function testGetDescription(): void
$dic['lng'] = $languageMock;
+ $logger_factory = $this->getMockBuilder(LoggerFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
$cron = new ilCertificateCron(
+ 'components\ILIAS\Certificate',
+ $languageMock,
+ $logger_factory,
$queueRepository,
$templateRepository,
$userRepository,
$valueReplacement,
$logger,
- $dic,
- $languageMock
+ $dic
);
$title = $cron->getDescription();
@@ -211,14 +224,20 @@ public function testGetId(): void
$userMock
);
+ $logger_factory = $this->getMockBuilder(LoggerFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
$cron = new ilCertificateCron(
+ 'components\ILIAS\Certificate',
+ $languageMock,
+ $logger_factory,
$queueRepository,
$templateRepository,
$userRepository,
$valueReplacement,
$logger,
$dic,
- $languageMock,
$objectHelper
);
@@ -292,15 +311,20 @@ public function testActivation(): void
$objectMock,
$userMock
);
+ $logger_factory = $this->getMockBuilder(LoggerFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
$cron = new ilCertificateCron(
+ 'components\ILIAS\Certificate',
+ $languageMock,
+ $logger_factory,
$queueRepository,
$templateRepository,
$userRepository,
$valueReplacement,
$logger,
$dic,
- $languageMock,
$objectHelper
);
@@ -375,14 +399,20 @@ public function testFlexibleActivation(): void
$userMock
);
+ $logger_factory = $this->getMockBuilder(LoggerFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
$cron = new ilCertificateCron(
+ 'components\ILIAS\Certificate',
+ $languageMock,
+ $logger_factory,
$queueRepository,
$templateRepository,
$userRepository,
$valueReplacement,
$logger,
$dic,
- $languageMock,
$objectHelper
);
@@ -457,14 +487,20 @@ public function testGetDefaultScheduleType(): void
$userMock
);
+ $logger_factory = $this->getMockBuilder(LoggerFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
$cron = new ilCertificateCron(
+ 'components\ILIAS\Certificate',
+ $languageMock,
+ $logger_factory,
$queueRepository,
$templateRepository,
$userRepository,
$valueReplacement,
$logger,
$dic,
- $languageMock,
$objectHelper
);
@@ -539,14 +575,20 @@ public function testGetDefaultScheduleValue(): void
$userMock
);
+ $logger_factory = $this->getMockBuilder(LoggerFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
$cron = new ilCertificateCron(
+ 'components\ILIAS\Certificate',
+ $languageMock,
+ $logger_factory,
$queueRepository,
$templateRepository,
$userRepository,
$valueReplacement,
$logger,
$dic,
- $languageMock,
$objectHelper
);
diff --git a/components/ILIAS/CmiXapi/CmiXapi.php b/components/ILIAS/CmiXapi/CmiXapi.php
index 082632f6ef66..923de6dc1553 100644
--- a/components/ILIAS/CmiXapi/CmiXapi.php
+++ b/components/ILIAS/CmiXapi/CmiXapi.php
@@ -36,5 +36,17 @@ public function init(
new \ilCmiXapiSetupAgent(
$pull[\ILIAS\Refinery\Factory::class]
);
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilXapiResultsCronjob(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilCmiXapiDelCron(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/CmiXapi/classes/class.ilCmiXapiDelCron.php b/components/ILIAS/CmiXapi/classes/class.ilCmiXapiDelCron.php
index aa275055763c..749f68e452a6 100755
--- a/components/ILIAS/CmiXapi/classes/class.ilCmiXapiDelCron.php
+++ b/components/ILIAS/CmiXapi/classes/class.ilCmiXapiDelCron.php
@@ -39,19 +39,15 @@ class ilCmiXapiDelCron extends ilCronJob
private \ILIAS\DI\Container $dic;
- public function __construct()
+ public function init(): void
{
- global $DIC; /* @var \ILIAS\DI\Container $DIC */
- $this->dic = $DIC;
-
- $DIC->language()->loadLanguageModule('cmix');
-
- $this->log = ilLoggerFactory::getLogger('cmix');
+ $this->lng->loadLanguageModule('cmix');
+ $this->log = $this->logger_factory->getLogger('cmix');
$settings = new ilSetting(self::JOB_ID);
$lrsTypeId = $settings->get('lrs_type_id', '0');
- if($lrsTypeId) {
+ if ($lrsTypeId) {
$this->lrsType = new ilCmiXapiLrsType((int) $lrsTypeId);
} else {
$this->lrsType = null;
@@ -67,12 +63,12 @@ public function getId(): string
public function getTitle(): string
{
- return $this->dic->language()->txt("cron_xapi_del");
+ return $this->lng->txt("cron_xapi_del");
}
public function getDescription(): string
{
- return $this->dic->language()->txt("cron_xapi_del_desc");
+ return $this->lng->txt("cron_xapi_del_desc");
}
/**
@@ -224,7 +220,7 @@ public function run(): ilCronJobResult
$deletedObjectData = array();
$allDone = true;
foreach ($newDeletedObjects as $deletedObject) {
- $this->log->debug("delete for " . (string)$deletedObject['obj_id']);
+ $this->log->debug("delete for " . (string) $deletedObject['obj_id']);
// set object to updated
$this->model->setXapiObjAsUpdated($deletedObject['obj_id']);
// delete data
@@ -239,7 +235,7 @@ public function run(): ilCronJobResult
// entry in xxcf_users is already deleted from ilXapiCmi5StatementsDeleteRequest
// delete in obj_id from xxcf_data_settings
if ($done) {
- $this->log->debug("deleted data for object: " . (string)$deletedObject['obj_id']);
+ $this->log->debug("deleted data for object: " . (string) $deletedObject['obj_id']);
$deletedObjectData[] = $deletedObject['obj_id'];
$this->model->deleteXapiObjectEntry($deletedObject['obj_id']);
} else {
diff --git a/components/ILIAS/CmiXapi/classes/class.ilXapiResultsCronjob.php b/components/ILIAS/CmiXapi/classes/class.ilXapiResultsCronjob.php
index bbc5a70ab3ad..be9ebe3e850d 100755
--- a/components/ILIAS/CmiXapi/classes/class.ilXapiResultsCronjob.php
+++ b/components/ILIAS/CmiXapi/classes/class.ilXapiResultsCronjob.php
@@ -1,7 +1,5 @@
dic = $DIC;
-
- $DIC->language()->loadLanguageModule('cmix');
-
- $this->log = ilLoggerFactory::getLogger('cmix');
+ $this->lng->loadLanguageModule('cmix');
+ $this->log = $this->logger_factory->getLogger('cmix');
$this->initThisRunTS();
$this->readLastRunTS();
@@ -88,12 +85,12 @@ public function getId(): string
public function getTitle(): string
{
- return $this->dic->language()->txt("cron_xapi_results_evaluation");
+ return $this->lng->txt("cron_xapi_results_evaluation");
}
public function getDescription(): string
{
- return $this->dic->language()->txt("cron_xapi_results_evaluation_desc");
+ return $this->lng->txt("cron_xapi_results_evaluation_desc");
}
public function hasAutoActivation(): bool
diff --git a/components/ILIAS/CmiXapi/module.xml b/components/ILIAS/CmiXapi/module.xml
index 2406a25b12b2..822525c81ae2 100755
--- a/components/ILIAS/CmiXapi/module.xml
+++ b/components/ILIAS/CmiXapi/module.xml
@@ -31,10 +31,6 @@
-
-
-
-
diff --git a/components/ILIAS/Component/classes/Setup/class.ilComponentDefinitionsStoredObjective.php b/components/ILIAS/Component/classes/Setup/class.ilComponentDefinitionsStoredObjective.php
index 88638d83065d..c6ae2d132e81 100755
--- a/components/ILIAS/Component/classes/Setup/class.ilComponentDefinitionsStoredObjective.php
+++ b/components/ILIAS/Component/classes/Setup/class.ilComponentDefinitionsStoredObjective.php
@@ -1,4 +1,5 @@
settingsFor(),
- $component_repository,
- $component_factory
- ),
new \ilMailTemplateContextDefinitionProcessor($db),
new \ilObjectDefinitionProcessor($db),
new \ilSystemCheckDefinitionProcessor($db),
diff --git a/components/ILIAS/Course/Course.php b/components/ILIAS/Course/Course.php
index 085ff5185c3c..0affdbf602c9 100644
--- a/components/ILIAS/Course/Course.php
+++ b/components/ILIAS/Course/Course.php
@@ -40,5 +40,11 @@ public function init(
new \ilCourseSetupAgent(
$pull[\ILIAS\Refinery\Factory::class]
);
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilTimingsCronReminder(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/Course/classes/class.ilTimingsCronReminder.php b/components/ILIAS/Course/classes/class.ilTimingsCronReminder.php
index 18b6bd4a342f..d7031c0ec91d 100755
--- a/components/ILIAS/Course/classes/class.ilTimingsCronReminder.php
+++ b/components/ILIAS/Course/classes/class.ilTimingsCronReminder.php
@@ -1,9 +1,5 @@
log = $DIC->logger()->crs();
- $this->lng = $DIC->language();
$this->lng->loadLanguageModule('crs');
+ $this->log = $this->logger_factory->getLogger('crs');
+
+ global $DIC;
$this->db = $DIC->database();
$this->obj_data_cache = $DIC['ilObjDataCache'];
diff --git a/components/ILIAS/Course/module.xml b/components/ILIAS/Course/module.xml
index 582678d6a00a..f68168f120de 100755
--- a/components/ILIAS/Course/module.xml
+++ b/components/ILIAS/Course/module.xml
@@ -41,9 +41,6 @@
-
-
-
diff --git a/components/ILIAS/Cron/Cron.php b/components/ILIAS/Cron/Cron.php
index 8c77b9fcf587..4c719055ca76 100644
--- a/components/ILIAS/Cron/Cron.php
+++ b/components/ILIAS/Cron/Cron.php
@@ -32,6 +32,20 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
- // ...
+ $contribute[\ILIAS\Setup\Agent::class] = static fn() =>
+ new \ilCronJobSetupAgent(
+ $seek[\ILIAS\Cron\CronJob::class]
+ );
+
+ $define[] = Cron\Registry::class;
+
+ $provide[Cron\Registry::class] = static fn() =>
+ $internal[Cron\CronRegistry::class];
+
+ $internal[Cron\CronRegistry::class] = static fn() =>
+ new Cron\CronRegistry(
+ $seek[\ILIAS\Cron\CronJob::class]
+ );
+
}
}
diff --git a/components/ILIAS/Cron/README.md b/components/ILIAS/Cron/README.md
index 6d39ebdb0b29..1d33755f309c 100755
--- a/components/ILIAS/Cron/README.md
+++ b/components/ILIAS/Cron/README.md
@@ -21,27 +21,33 @@ described in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt).
## Implementing and Configuring a Cron-Job
To give more control of if and when cron-jobs are executed to administrators a 2nd implementation of cron-jobs
-has been added to ILIAS 4.4+. All existing cron-jobs have been migrated and thus moved to their respective modules
-and services. The top-level directory "cron/" will probably be kept because of cron.php but should otherwise be empty
-at some point.
+has been added to ILIAS 4.4+. All existing cron-jobs have been migrated and thus moved to their respective component.
+The top-level directory "cron/" was removed.
### Providing a Cron-Job
-A module or service has to "announce" its cron-jobs to the system by adding them to their respective
-module.xml or service.xml.
-
-- The job id has to be unique.
-- An optional path can be added if the module/service directory layout differs from the ILIAS standard.
-
+A component has to contribute its cron-jobs to the system in its Component-class:
```php
-
-
- ...
-
-
-
-
+class MyComponent implements Component\Component
+{
+ public function init(
+ array | \ArrayAccess &$define,
+ array | \ArrayAccess &$implement,
+ array | \ArrayAccess &$use,
+ array | \ArrayAccess &$contribute,
+ array | \ArrayAccess &$seek,
+ array | \ArrayAccess &$provide,
+ array | \ArrayAccess &$pull,
+ array | \ArrayAccess &$internal,
+ ): void {
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \MyComponentCronJob(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class],
+ );
+ }
+}
```
There are 3 basic concepts: cron-job, schedule and cron-result. Using them as intended should make testing
@@ -61,6 +67,7 @@ Several abstract methods have to be implemented to make a new cron-job usable:
- `getDefaultScheduleType()`: see Schedule
- `getDefaultScheduleValue()`: see Schedule
- `run()`: process the cron-job
+- `init()`: called in ilCronJobEntity; may be used to initialize further dependencies
### ilCronJobResult
@@ -176,7 +183,7 @@ So as mentioned above the cron-tab can safely be set to every few minutes.
In order to execute the cron job manager, the following command MUST be used:
```shell
-/usr/bin/php [PATH_TO_ILIAS]/cron/cron.php run-jobs run-jobs
+/usr/bin/php [PATH_TO_ILIAS]/cli/cron.php run-jobs
```
The `` MUST be a valid (but arbitrary) user account of the ILIAS installation.
diff --git a/components/ILIAS/Cron/classes/Setup/class.ilCronDefinitionProcessor.php b/components/ILIAS/Cron/classes/Setup/class.ilCronDefinitionProcessor.php
deleted file mode 100755
index 879d8203e116..000000000000
--- a/components/ILIAS/Cron/classes/Setup/class.ilCronDefinitionProcessor.php
+++ /dev/null
@@ -1,92 +0,0 @@
-has_cron = [];
-
- $this->cronRepository = new ilCronJobRepositoryImpl(
- $this->db,
- $setting,
- new NullLogger(),
- $componentRepository,
- $componentFactory
- );
- }
-
- public function purge(): void
- {
- }
-
- public function beginComponent(string $component, string $type): void
- {
- $this->component = $type . "/" . $component;
- $this->has_cron = [];
- }
-
- public function endComponent(string $component, string $type): void
- {
- $this->component = null;
- $this->has_cron = [];
- }
-
- public function beginTag(string $name, array $attributes): void
- {
- if ($name !== "cron") {
- return;
- }
-
- $component = $attributes["component"] ?? null;
- if (!$component) {
- $component = $this->component;
- }
-
- $this->cronRepository->registerJob(
- $component,
- $attributes["id"],
- $attributes["class"],
- ($attributes["path"] ?? null)
- );
-
- $this->has_cron[] = $attributes["id"];
- }
-
- public function endTag(string $name): void
- {
- if ($name !== "module" && $name !== "service") {
- return;
- }
-
- $this->cronRepository->unregisterJob($this->component, $this->has_cron);
- }
-}
diff --git a/components/ILIAS/Cron/classes/Setup/class.ilCronJobSetupAgent.php b/components/ILIAS/Cron/classes/Setup/class.ilCronJobSetupAgent.php
new file mode 100644
index 000000000000..a15546ad80eb
--- /dev/null
+++ b/components/ILIAS/Cron/classes/Setup/class.ilCronJobSetupAgent.php
@@ -0,0 +1,81 @@
+cronjobs
+ );
+ }
+
+ public function getUpdateObjective(Setup\Config $config = null): Setup\Objective
+ {
+ return new ilCronjobsRegisteredObjective(
+ $this->cronjobs
+ );
+ }
+
+ public function getBuildObjective(): Setup\Objective
+ {
+ return new Setup\Objective\NullObjective();
+ }
+
+ public function getStatusObjective(Setup\Metrics\Storage $storage): Setup\Objective
+ {
+ return new Setup\Objective\NullObjective();
+ }
+
+ public function getMigrations(): array
+ {
+ return [];
+ }
+
+ public function getNamedObjectives(?Setup\Config $config = null): array
+ {
+ return [
+ 'registerCronJobs' => new Setup\ObjectiveConstructor(
+ 'registers cron jobs',
+ fn(): Setup\Objective => new ilCronjobsRegisteredObjective(
+ $this->cronjobs
+ )
+ )
+ ];
+ }
+}
diff --git a/components/ILIAS/Cron/classes/Setup/class.ilCronJobsRegisteredObjective.php b/components/ILIAS/Cron/classes/Setup/class.ilCronJobsRegisteredObjective.php
new file mode 100644
index 000000000000..d3720099ec09
--- /dev/null
+++ b/components/ILIAS/Cron/classes/Setup/class.ilCronJobsRegisteredObjective.php
@@ -0,0 +1,99 @@
+getResource(Setup\Environment::RESOURCE_DATABASE);
+ /** @var ilComponentRepository $component_repository */
+ $component_repository = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY);
+ /** @var ilComponentFactory $component_factory */
+ $component_factory = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_FACTORY);
+ /** @var ilSettingsFactory $settings_factory */
+ $settings_factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
+
+ $mock_logger_factory = new class () implements \ILIAS\Logging\LoggerFactory {
+ };
+
+ $registry = new ILIAS\Cron\CronRegistry($this->cronjobs);
+ $language = new ilSetupLanguage('en');
+
+ $repo = new ilCronJobRepositoryImpl(
+ $registry,
+ $db,
+ $settings_factory->settingsFor(),
+ new ILIAS\components\Logging\NullLogger(),
+ $component_repository,
+ $component_factory,
+ $language,
+ $mock_logger_factory
+ );
+
+ $repo->unregisterAllJobs();
+
+ foreach ($this->cronjobs as $class => $job) {
+ $repo->registerJob(
+ $job->getComponent(),
+ $job->getId(),
+ get_class($job),
+ null //path!
+ );
+ }
+
+ return $environment;
+ }
+
+ public function isApplicable(Setup\Environment $environment): bool
+ {
+ return true;
+ }
+}
diff --git a/components/ILIAS/Cron/classes/class.ilCronJob.php b/components/ILIAS/Cron/classes/class.ilCronJob.php
index c1881e23e968..6ddb7c626727 100755
--- a/components/ILIAS/Cron/classes/class.ilCronJob.php
+++ b/components/ILIAS/Cron/classes/class.ilCronJob.php
@@ -19,13 +19,34 @@
declare(strict_types=1);
use ILIAS\Cron\Schedule\CronJobScheduleType;
+use ILIAS\Cron\CronJob;
-abstract class ilCronJob
+abstract class ilCronJob implements CronJob
{
protected ?CronJobScheduleType $schedule_type = null;
protected ?int $schedule_value = null;
protected ?Closure $date_time_provider = null;
+ public function __construct(
+ protected readonly string $component,
+ protected readonly \ILIAS\Language\Language $lng,
+ protected readonly \ILIAS\Logging\LoggerFactory $logger_factory,
+ ) {
+ }
+
+ /**
+ * init is called when actually using the job;
+ * once the jobs are properly constructed via Component,this is obsolete.
+ */
+ public function init(): void
+ {
+ }
+
+ public function getComponent(): string
+ {
+ return $this->component;
+ }
+
private function checkWeeklySchedule(DateTimeImmutable $last_run, DateTimeImmutable $now): bool
{
$last_year = (int) $last_run->format('Y');
diff --git a/components/ILIAS/Cron/classes/class.ilCronJobEntities.php b/components/ILIAS/Cron/classes/class.ilCronJobEntities.php
index 1b7c6156bd78..3ace3f892ee3 100755
--- a/components/ILIAS/Cron/classes/class.ilCronJobEntities.php
+++ b/components/ILIAS/Cron/classes/class.ilCronJobEntities.php
@@ -20,11 +20,11 @@
class ilCronJobEntities implements ilCronJobCollection
{
- private readonly ArrayIterator $jobs;
+ private array $jobs;
public function __construct(ilCronJobEntity ...$jobs)
{
- $this->jobs = new ArrayIterator($jobs);
+ $this->jobs = $jobs;
}
/**
@@ -32,27 +32,27 @@ public function __construct(ilCronJobEntity ...$jobs)
*/
public function getIterator(): ArrayIterator
{
- return $this->jobs;
+ return new ArrayIterator($this->jobs);
}
public function count(): int
{
- return iterator_count($this);
+ return count($this->jobs);
}
public function add(ilCronJobEntity $job): void
{
- $this->jobs->append($job);
+ $this->jobs[] = $job;
}
public function filter(callable $callable): ilCronJobCollection
{
- return new static(...array_filter(iterator_to_array($this), $callable));
+ return new static(...array_filter($this->jobs, $callable));
}
public function slice(int $offset, ?int $length = null): ilCronJobCollection
{
- return new static(...array_slice(iterator_to_array($this), $offset, $length, true));
+ return new static(...array_slice($this->jobs, $offset, $length, true));
}
/**
@@ -60,6 +60,6 @@ public function slice(int $offset, ?int $length = null): ilCronJobCollection
*/
public function toArray(): array
{
- return iterator_to_array($this);
+ return $this->jobs;
}
}
diff --git a/components/ILIAS/Cron/classes/class.ilCronJobEntity.php b/components/ILIAS/Cron/classes/class.ilCronJobEntity.php
index 4c253cb0a816..7531277b21df 100755
--- a/components/ILIAS/Cron/classes/class.ilCronJobEntity.php
+++ b/components/ILIAS/Cron/classes/class.ilCronJobEntity.php
@@ -19,6 +19,7 @@
declare(strict_types=1);
use ILIAS\Cron\Schedule\CronJobScheduleType;
+use ILIAS\Cron\CronJob;
class ilCronJobEntity
{
@@ -48,18 +49,20 @@ class ilCronJobEntity
* @param array $record
* @param bool $isPlugin
*/
- public function __construct(private readonly ilCronJob $job, array $record, private readonly bool $isPlugin = false)
+ public function __construct(private readonly CronJob $job, array $record, private readonly bool $isPlugin = false)
{
- $this->mapRecord($record);
+ $job->init();
+ $this->mapRecord($job, $record);
}
/**
* @param array $record
*/
- private function mapRecord(array $record): void
+ private function mapRecord(CronJob $job, array $record): void
{
- $this->jobId = (string) $record['job_id'];
- $this->component = (string) $record['component'];
+ $this->jobId = $job->getId();
+ $this->component = $job->getComponent();
+
$this->scheduleType = is_numeric($record['schedule_type']) ? CronJobScheduleType::tryFrom((int) $record['schedule_type']) : null;
$this->scheduleValue = (int) $record['schedule_value'];
$this->jobStatus = (int) $record['job_status'];
diff --git a/components/ILIAS/Cron/classes/class.ilCronJobRepositoryImpl.php b/components/ILIAS/Cron/classes/class.ilCronJobRepositoryImpl.php
index 6fd98b96af1a..50fb4bccf59c 100755
--- a/components/ILIAS/Cron/classes/class.ilCronJobRepositoryImpl.php
+++ b/components/ILIAS/Cron/classes/class.ilCronJobRepositoryImpl.php
@@ -19,63 +19,33 @@
declare(strict_types=1);
use ILIAS\Cron\Schedule\CronJobScheduleType;
+use ILIAS\Cron\Registry;
class ilCronJobRepositoryImpl implements ilCronJobRepository
{
private const TYPE_PLUGINS = 'Plugins';
public function __construct(
+ private readonly Registry $registry,
private readonly ilDBInterface $db,
private readonly ilSetting $setting,
private readonly ilLogger $logger,
private readonly ilComponentRepository $componentRepository,
- private readonly ilComponentFactory $componentFactory
+ private readonly ilComponentFactory $componentFactory,
+ private readonly ILIAS\Language\Language $lng,
+ private readonly ILIAS\Logging\LoggerFactory $logger_factory
) {
}
public function getJobInstanceById(string $id): ?ilCronJob
{
- // plugin
- if (str_starts_with($id, 'pl__')) {
- $parts = explode('__', $id);
- $pl_name = $parts[1];
- $job_id = $parts[2];
-
- foreach ($this->componentRepository->getPlugins() as $pl) {
- if ($pl->getName() !== $pl_name || !$pl->isActive()) {
- continue;
- }
-
- $plugin = $this->componentFactory->getPlugin($pl->getId());
- if (!$plugin instanceof ilCronJobProvider) {
- continue;
- }
-
- try {
- $job = $plugin->getCronJobInstance($job_id);
-
- // should never happen but who knows...
- $jobs_data = $this->getCronJobData($job_id);
- if ($jobs_data === []) {
- // as job is not 'imported' from xml
- $this->createDefaultEntry($job, $pl_name, self::TYPE_PLUGINS, '');
- }
-
- return $job;
- } catch (OutOfBoundsException) {
- // Maybe a job was removed from plugin, renamed etc.
- }
- break;
- }
- } else {
- $jobs_data = $this->getCronJobData($id);
- if ($jobs_data !== [] && $jobs_data[0]['job_id'] === $id) {
- return $this->getJobInstance(
- $jobs_data[0]['job_id'],
- $jobs_data[0]['component'],
- $jobs_data[0]['class']
- );
- }
+ $jobs_data = $this->getCronJobData($id);
+ if ($jobs_data !== [] && $jobs_data[0]['job_id'] === $id) {
+ return $this->getJobInstance(
+ $jobs_data[0]['job_id'],
+ $jobs_data[0]['component'],
+ $jobs_data[0]['class']
+ );
}
$this->logger->info('CRON - job ' . $id . ' seems invalid or is inactive');
@@ -86,16 +56,15 @@ public function getJobInstanceById(string $id): ?ilCronJob
public function getJobInstance(
string $a_id,
string $a_component,
- string $a_class,
- bool $isCreationContext = false
+ string $a_class
): ?ilCronJob {
+
if (class_exists($a_class)) {
- if ($isCreationContext) {
- $refl = new ReflectionClass($a_class);
- $job = $refl->newInstanceWithoutConstructor();
- } else {
- $job = new $a_class();
- }
+ $job = new $a_class(
+ $a_component,
+ $this->lng,
+ $this->logger_factory
+ );
if ($job instanceof ilCronJob && $job->getId() === $a_id) {
return $job;
@@ -146,13 +115,18 @@ public function registerJob(
if (!$this->db->tableExists('cron_job')) {
return;
}
-
- $job = $this->getJobInstance($a_id, $a_component, $a_class, true);
+ $job = $this->getJobInstance($a_id, $a_component, $a_class);
if ($job) {
$this->createDefaultEntry($job, $a_component, $a_class, $a_path);
}
}
+ public function unregisterAllJobs(): void
+ {
+ $query = 'DELETE FROM cron_job';
+ $res = $this->db->manipulate($query);
+ }
+
public function unregisterJob(string $a_component, array $a_xml_job_ids): void
{
if (!$this->db->tableExists('cron_job')) {
@@ -391,21 +365,11 @@ public function findAll(): ilCronJobCollection
{
$collection = new ilCronJobEntities();
- foreach ($this->getCronJobData() as $item) {
- $job = $this->getJobInstance(
- $item['job_id'],
- $item['component'],
- $item['class']
- );
- if ($job) {
- $collection->add(new ilCronJobEntity($job, $item));
- }
- }
-
- foreach ($this->getPluginJobs() as $item) {
- $collection->add(new ilCronJobEntity($item[0], $item[1], true));
+ foreach ($this->registry->getAllJobs() as $job) {
+ $job_data = $this->getCronJobData($job->getId());
+ $entity = new ilCronJobEntity($job, array_shift($job_data));
+ $collection->add($entity);
}
-
return $collection;
}
}
diff --git a/components/ILIAS/Cron/classes/class.ilCronManagerImpl.php b/components/ILIAS/Cron/classes/class.ilCronManagerImpl.php
index cc8c8fd32911..10f4941f9704 100755
--- a/components/ILIAS/Cron/classes/class.ilCronManagerImpl.php
+++ b/components/ILIAS/Cron/classes/class.ilCronManagerImpl.php
@@ -166,6 +166,7 @@ private function runJob(ilCronJob $job, ilObjUser $actor, ?array $jobData = null
$ts_in = $this->getMicrotime();
try {
+ $job->init();
$result = $job->run();
} catch (Throwable $e) {
$result = new ilCronJobResult();
diff --git a/components/ILIAS/Cron/classes/class.ilCronStartUp.php b/components/ILIAS/Cron/classes/class.ilCronStartUp.php
index 048ac1472ff2..e0194fc95bb3 100755
--- a/components/ILIAS/Cron/classes/class.ilCronStartUp.php
+++ b/components/ILIAS/Cron/classes/class.ilCronStartUp.php
@@ -28,13 +28,6 @@ public function __construct(
private readonly string $username,
?ilAuthSession $authSession = null
) {
- /** @noRector */
- ilContext::init(ilContext::CONTEXT_CRON);
-
- // TODO @see mantis 20371: To get rid of this, the authentication service has to provide a mechanism to pass the client_id
- $_GET['client_id'] = $this->client;
- ilInitialisation::initILIAS();
-
if (null === $authSession) {
global $DIC;
$authSession = $DIC['ilAuthSession'];
diff --git a/components/ILIAS/Cron/interfaces/interface.CronJob.php b/components/ILIAS/Cron/interfaces/interface.CronJob.php
new file mode 100644
index 000000000000..a7e963534fe3
--- /dev/null
+++ b/components/ILIAS/Cron/interfaces/interface.CronJob.php
@@ -0,0 +1,38 @@
+jobs;
+ }
+}
diff --git a/components/ILIAS/Cron/src/Registry.php b/components/ILIAS/Cron/src/Registry.php
new file mode 100644
index 000000000000..fa4bc765e991
--- /dev/null
+++ b/components/ILIAS/Cron/src/Registry.php
@@ -0,0 +1,26 @@
+createMock(ilCronJob::class);
+ $job_instance ??= new class (
+ $schedule_type,
+ $schedule_value
+ ) implements CronJob {
+ public function __construct(
+ private $schedule_type,
+ private $schedule_value
+ ) {
+ }
+ public function getId(): string
+ {
+ return 'phpunit';
+ }
+ public function getComponent(): string
+ {
+ return 'phpunit';
+ }
+ public function getTitle(): string
+ {
+ return 'phpunit';
+ }
+ public function getDescription(): string
+ {
+ return 'phpunit';
+ }
+ public function getScheduleType(): ?CronJobScheduleType
+ {
+ return $this->schedule_type;
+ }
+ public function getScheduleValue(): ?int
+ {
+ return $this->schedule_value;
+ }
+ public function run(): \ilCronJobResult
+ {
+ return new \ilCronJobResult();
+ }
+ public function init(): void
+ {
+ }
+ };
if ($schedule_type === null) {
$schedule_type = CronJobScheduleType::SCHEDULE_TYPE_IN_MINUTES->value;
@@ -91,9 +132,14 @@ public function testCollectionCanBeChanged(ilCronJobEntities $entities): ilCronJ
*/
public function testCollectionCanBeFilteredAndSliced(ilCronJobEntities $entities): void
{
- $this->assertCount(0, $entities->filter(static function (ilCronJobEntity $entity): bool {
- return $entity->getJobId() !== 'phpunit';
- }));
+ $this->assertCount(
+ 0,
+ $entities->filter(
+ static function (ilCronJobEntity $entity): bool {
+ return $entity->getJobId() !== 'phpunit';
+ }
+ )
+ );
$this->assertCount(1, $entities->slice(1, 1));
}
diff --git a/components/ILIAS/Exercise/Exercise.php b/components/ILIAS/Exercise/Exercise.php
index e6dc61d77cd9..c70f85f70100 100644
--- a/components/ILIAS/Exercise/Exercise.php
+++ b/components/ILIAS/Exercise/Exercise.php
@@ -42,5 +42,17 @@ public function init(
new Component\Resource\ComponentJS($this, "ilExcPresentation.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "ilExcPeerReview.js");
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilExcCronFeedbackNotification(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilExcCronReminders(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/Exercise/classes/class.ilExcCronFeedbackNotification.php b/components/ILIAS/Exercise/classes/class.ilExcCronFeedbackNotification.php
index 94fb217fd142..405f24fc9051 100755
--- a/components/ILIAS/Exercise/classes/class.ilExcCronFeedbackNotification.php
+++ b/components/ILIAS/Exercise/classes/class.ilExcCronFeedbackNotification.php
@@ -26,14 +26,9 @@
*/
class ilExcCronFeedbackNotification extends ilCronJob
{
- protected ilLanguage $lng;
-
-
- public function __construct()
+ public function init(): void
{
- global $DIC;
-
- $this->lng = $DIC->language();
+ $this->lng->loadLanguageModule('exc');
}
public function getId(): string
@@ -43,18 +38,12 @@ public function getId(): string
public function getTitle(): string
{
- $lng = $this->lng;
-
- $lng->loadLanguageModule("exc");
- return $lng->txt("exc_global_feedback_file_cron");
+ return $this->lng->txt("exc_global_feedback_file_cron");
}
public function getDescription(): string
{
- $lng = $this->lng;
-
- $lng->loadLanguageModule("exc");
- return $lng->txt("exc_global_feedback_file_cron_info");
+ return $this->lng->txt("exc_global_feedback_file_cron_info");
}
public function getDefaultScheduleType(): CronJobScheduleType
diff --git a/components/ILIAS/Exercise/classes/class.ilExcCronReminders.php b/components/ILIAS/Exercise/classes/class.ilExcCronReminders.php
index b14b9f85ad37..23f653b43f52 100755
--- a/components/ILIAS/Exercise/classes/class.ilExcCronReminders.php
+++ b/components/ILIAS/Exercise/classes/class.ilExcCronReminders.php
@@ -26,13 +26,9 @@
*/
class ilExcCronReminders extends ilCronJob
{
- protected ilLanguage $lng;
-
- public function __construct()
+ public function init(): void
{
- global $DIC;
-
- $this->lng = $DIC->language();
+ $this->lng->loadLanguageModule('exc');
}
public function getId(): string
diff --git a/components/ILIAS/Exercise/module.xml b/components/ILIAS/Exercise/module.xml
index cecc31ad9787..05ffd61ce1ea 100755
--- a/components/ILIAS/Exercise/module.xml
+++ b/components/ILIAS/Exercise/module.xml
@@ -25,10 +25,6 @@
wfld
-
-
-
-
diff --git a/components/ILIAS/Filesystem/Filesystem.php b/components/ILIAS/Filesystem/Filesystem.php
index 421dc2883e95..4a9528c07715 100644
--- a/components/ILIAS/Filesystem/Filesystem.php
+++ b/components/ILIAS/Filesystem/Filesystem.php
@@ -40,5 +40,12 @@ public function init(
new \ilFileSystemSetupAgent(
$pull[Factory::class]
);
+
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilFileSystemCleanTempDirCron(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/Filesystem/classes/class.ilFileSystemCleanTempDirCron.php b/components/ILIAS/Filesystem/classes/class.ilFileSystemCleanTempDirCron.php
index 4c4b19cacbe5..816147ace95d 100755
--- a/components/ILIAS/Filesystem/classes/class.ilFileSystemCleanTempDirCron.php
+++ b/components/ILIAS/Filesystem/classes/class.ilFileSystemCleanTempDirCron.php
@@ -28,29 +28,19 @@
class ilFileSystemCleanTempDirCron extends ilCronJob
{
protected Filesystem $filesystem;
-
- protected ilLanguage $language;
-
protected ilLogger $logger;
- /**
- * @inheritDoc
- */
- public function __construct()
+ public function init(): void
{
+ $this->logger = $this->logger_factory->getRootLogger();
+
/**
* @var $DIC Container
*/
global $DIC;
- if ($DIC->offsetExists('lng')) {
- $this->language = $DIC['lng'];
- }
if ($DIC->offsetExists('filesystem')) {
$this->filesystem = $DIC->filesystem()->temp();
}
- if ($DIC->offsetExists('ilLoggerFactory')) {
- $this->logger = $DIC->logger()->root();
- }
}
private function initDependencies(): void
@@ -64,12 +54,12 @@ public function getId(): string
public function getTitle(): string
{
- return $this->language->txt('file_system_clean_temp_dir_cron');
+ return $this->lng->txt('file_system_clean_temp_dir_cron');
}
public function getDescription(): string
{
- return $this->language->txt("file_system_clean_temp_dir_cron_info");
+ return $this->lng->txt("file_system_clean_temp_dir_cron_info");
}
public function hasAutoActivation(): bool
diff --git a/components/ILIAS/Filesystem/service.xml b/components/ILIAS/Filesystem/service.xml
index dc131c3873cf..c14d8bee117a 100755
--- a/components/ILIAS/Filesystem/service.xml
+++ b/components/ILIAS/Filesystem/service.xml
@@ -3,7 +3,4 @@
id="filesys">
-
-
-
diff --git a/components/ILIAS/Forum/Forum.php b/components/ILIAS/Forum/Forum.php
index 0d79bcdc6cc0..6d5abd09e998 100644
--- a/components/ILIAS/Forum/Forum.php
+++ b/components/ILIAS/Forum/Forum.php
@@ -38,7 +38,15 @@ public function init(
);
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "autosave_forum.js");
+
$contribute[Component\Resource\PublicAsset::class] = fn() =>
- new Component\Resource\ComponentCSS($this, "forum_table.css");
+ new Component\Resource\ComponentCSS($this, "forum_table.css");
+
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilForumCronNotification(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/Forum/classes/class.ilForumCronNotification.php b/components/ILIAS/Forum/classes/class.ilForumCronNotification.php
index 87f2e029d8b9..7180db3f6a08 100755
--- a/components/ILIAS/Forum/classes/class.ilForumCronNotification.php
+++ b/components/ILIAS/Forum/classes/class.ilForumCronNotification.php
@@ -41,32 +41,24 @@ class ilForumCronNotification extends ilCronJob
/** @var array */
private static array $container_by_frm_ref_id = [];
- private readonly ilLanguage $lng;
- private readonly ilSetting $settings;
+ private ilSetting $settings;
private ilLogger $logger;
private ilTree $tree;
private int $num_sent_messages = 0;
- private readonly ilDBInterface $ilDB;
- private readonly ilForumNotificationCache $notificationCache;
- private readonly \ILIAS\Refinery\Factory $refinery;
- private readonly ilCronManager $cronManager;
-
- public function __construct(
- ?ilDBInterface $database = null,
- ?ilForumNotificationCache $notificationCache = null,
- ?ilLanguage $lng = null,
- ?ilSetting $settings = null,
- ?\ILIAS\Refinery\Factory $refinery = null,
- ?ilCronManager $cronManager = null
- ) {
- global $DIC;
+ private ilDBInterface $ilDB;
+ private ilForumNotificationCache $notificationCache;
+ private \ILIAS\Refinery\Factory $refinery;
+ private ilCronManager $cronManager;
- $this->settings = $settings ?? new ilSetting('frma');
- $this->lng = $lng ?? $DIC->language();
- $this->ilDB = $database ?? $DIC->database();
- $this->notificationCache = $notificationCache ?? new ilForumNotificationCache();
- $this->refinery = $refinery ?? $DIC->refinery();
- $this->cronManager = $cronManager ?? $DIC->cron()->manager();
+ public function init(): void
+ {
+ $this->logger = $this->logger_factory->getLogger('frm');
+ global $DIC;
+ $this->settings = new ilSetting('frma');
+ $this->ilDB = $DIC->database();
+ $this->notificationCache = new ilForumNotificationCache();
+ $this->refinery = $DIC->refinery();
+ $this->cronManager = $DIC->cron()->manager();
}
public function getId(): string
@@ -119,8 +111,6 @@ public function keepAlive(): void
public function run(): ilCronJobResult
{
global $DIC;
-
- $this->logger = $DIC->logger()->frm();
$this->tree = $DIC->repositoryTree();
$status = ilCronJobResult::STATUS_NO_ACTION;
diff --git a/components/ILIAS/Forum/module.xml b/components/ILIAS/Forum/module.xml
index ad0e3726f968..ed9b7f1fe1a6 100755
--- a/components/ILIAS/Forum/module.xml
+++ b/components/ILIAS/Forum/module.xml
@@ -32,9 +32,6 @@
-
-
-
diff --git a/components/ILIAS/Init/Init.php b/components/ILIAS/Init/Init.php
index 0f55e64f96fd..a2501c2135a0 100644
--- a/components/ILIAS/Init/Init.php
+++ b/components/ILIAS/Init/Init.php
@@ -120,6 +120,7 @@ public function init(
$pull[\ILIAS\UI\Implementation\Component\Progress\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Progress\State\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Progress\State\Bar\Factory::class],
+ $pull[\ILIAS\Cron\Registry::class],
);
}
}
diff --git a/components/ILIAS/Init/classes/class.ilInitialisation.php b/components/ILIAS/Init/classes/class.ilInitialisation.php
index 9f676c6dadbd..a239b8372ed0 100755
--- a/components/ILIAS/Init/classes/class.ilInitialisation.php
+++ b/components/ILIAS/Init/classes/class.ilInitialisation.php
@@ -762,11 +762,14 @@ protected static function initCron(\ILIAS\DI\Container $c): void
{
$c['cron.repository'] = static function (\ILIAS\DI\Container $c): ilCronJobRepository {
return new ilCronJobRepositoryImpl(
+ $c['cron.registry'],
$c->database(),
$c->settings(),
$c->logger()->cron(),
$c['component.repository'],
- $c['component.factory']
+ $c['component.factory'],
+ $c['lng'],
+ $c['ilLoggerFactory']
);
};
diff --git a/components/ILIAS/Init/src/AllModernComponents.php b/components/ILIAS/Init/src/AllModernComponents.php
index 7b302bd04e2a..8a926d3602bd 100644
--- a/components/ILIAS/Init/src/AllModernComponents.php
+++ b/components/ILIAS/Init/src/AllModernComponents.php
@@ -91,6 +91,7 @@ public function __construct(
protected \ILIAS\UI\Implementation\Component\Progress\Factory $ui_progress_factory,
protected \ILIAS\UI\Implementation\Component\Progress\State\Factory $ui_progress_state_factory,
protected \ILIAS\UI\Implementation\Component\Progress\State\Bar\Factory $ui_progress_state_bar_factory,
+ protected \ILIAS\Cron\Registry $cron_registry,
) {
}
@@ -165,6 +166,8 @@ protected function populateComponentsInLegacyEnvironment(\Pimple\Container $DIC)
$DIC['ui.factory.input.field'] = fn() => $this->ui_factory_input_field;
$DIC['ui.factory'] = fn() => $this->ui_factory;
$DIC['ui.renderer'] = fn() => $this->ui_renderer;
+
+ $DIC['cron.registry'] = fn() => $this->cron_registry;
}
public function getName(): string
diff --git a/components/ILIAS/LDAP/LDAP.php b/components/ILIAS/LDAP/LDAP.php
index 2488615ea94c..795ba2c87c9c 100644
--- a/components/ILIAS/LDAP/LDAP.php
+++ b/components/ILIAS/LDAP/LDAP.php
@@ -33,6 +33,12 @@ public function init(
array | \ArrayAccess &$internal,
): void {
$contribute[\ILIAS\Setup\Agent::class] = static fn() =>
- new \ILIAS\LDAP\Setup\Agent();
+ new \ILIAS\LDAP\Setup\Agent();
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilLDAPCronSynchronization(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/LDAP/classes/class.ilLDAPCronSynchronization.php b/components/ILIAS/LDAP/classes/class.ilLDAPCronSynchronization.php
index 2afe678f8bba..ee9cf30bfa9e 100755
--- a/components/ILIAS/LDAP/classes/class.ilLDAPCronSynchronization.php
+++ b/components/ILIAS/LDAP/classes/class.ilLDAPCronSynchronization.php
@@ -26,20 +26,18 @@
*/
class ilLDAPCronSynchronization extends ilCronJob
{
- private ilLanguage $lng;
private ilLogger $logger;
private ilCronManager $cronManager;
private int $counter = 0;
- public function __construct()
+ public function init(): void
{
- global $DIC;
+ $this->lng->loadLanguageModule('ldap');
+ global $DIC;
$this->logger = $DIC->logger()->auth();
$this->cronManager = $DIC->cron()->manager();
- $this->lng = $DIC->language();
- $this->lng->loadLanguageModule('ldap');
}
public function getId(): string
diff --git a/components/ILIAS/LDAP/service.xml b/components/ILIAS/LDAP/service.xml
index b80fb92c506e..7b0dde5bd2a0 100755
--- a/components/ILIAS/LDAP/service.xml
+++ b/components/ILIAS/LDAP/service.xml
@@ -6,7 +6,4 @@
-
-
-
diff --git a/components/ILIAS/LTIProvider/LTIProvider.php b/components/ILIAS/LTIProvider/LTIProvider.php
index fd0843291de0..959c41db8328 100644
--- a/components/ILIAS/LTIProvider/LTIProvider.php
+++ b/components/ILIAS/LTIProvider/LTIProvider.php
@@ -39,5 +39,12 @@ public function init(
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\Endpoint($this, "lti.php");
+
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilLTICronOutcomeService(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/LTIProvider/classes/class.ilLTICronOutcomeService.php b/components/ILIAS/LTIProvider/classes/class.ilLTICronOutcomeService.php
index 334e7f70b76b..9077f4b11254 100644
--- a/components/ILIAS/LTIProvider/classes/class.ilLTICronOutcomeService.php
+++ b/components/ILIAS/LTIProvider/classes/class.ilLTICronOutcomeService.php
@@ -28,14 +28,13 @@
*/
class ilLTICronOutcomeService extends ilCronJob
{
- private ilLanguage $lng;
private ilCronJobRepository $cronRepo;
- public function __construct()
+ public function init(): void
{
+ $this->lng->loadLanguageModule('lti');
+
global $DIC;
- $this->lng = $DIC->language();
- $this->lng->loadLanguageModule("lti");
$this->cronRepo = $DIC->cron()->repository();
}
diff --git a/components/ILIAS/LTIProvider/service.xml b/components/ILIAS/LTIProvider/service.xml
index 0d2564f42fa7..b35e0640222e 100644
--- a/components/ILIAS/LTIProvider/service.xml
+++ b/components/ILIAS/LTIProvider/service.xml
@@ -13,8 +13,5 @@
-
-
-
diff --git a/components/ILIAS/Logging/Logging.php b/components/ILIAS/Logging/Logging.php
index ea5202974232..f54b812f834c 100644
--- a/components/ILIAS/Logging/Logging.php
+++ b/components/ILIAS/Logging/Logging.php
@@ -32,9 +32,62 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
+ $define[] = \ILIAS\Logging\LoggerFactory::class;
+
+ $implement[\ILIAS\Logging\LoggerFactory::class] = static fn() =>
+ $internal[\ilLoggerFactory::class];
+
$contribute[\ILIAS\Setup\Agent::class] = static fn() =>
new \ilLoggingSetupAgent(
$pull[\ILIAS\Refinery\Factory::class]
);
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilLoggerCronCleanErrorFiles(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
+ $internal[\ilLoggerFactory::class] = static fn() =>
+ \ilLoggerFactory::getInstance(
+ $internal[\ilLoggingSettings::class]
+ );
+
+ $internal[\ilLoggingSettings::class] = static fn() =>
+ new class () implements \ilLoggingSettings {
+ public function isEnabled(): bool
+ {
+ return false;
+ }
+ public function getLogDir(): string
+ {
+ }
+ public function getLogFile(): string
+ {
+ }
+ public function getLevel(): int
+ {
+ }
+ public function getLevelByComponent(string $a_component_id): int
+ {
+ }
+ public function getCacheLevel(): int
+ {
+ }
+ public function isCacheEnabled(): bool
+ {
+ }
+ public function isMemoryUsageEnabled(): bool
+ {
+ }
+ public function isBrowserLogEnabled(): bool
+ {
+ }
+ public function isBrowserLogEnabledForUser(string $a_login): bool
+ {
+ }
+ public function getBrowserLogUsers(): array
+ {
+ }
+ };
}
}
diff --git a/components/ILIAS/Logging/classes/error/class.ilLoggerCronCleanErrorFiles.php b/components/ILIAS/Logging/classes/error/class.ilLoggerCronCleanErrorFiles.php
index e9b3eb734b21..da29f33ec2f2 100755
--- a/components/ILIAS/Logging/classes/error/class.ilLoggerCronCleanErrorFiles.php
+++ b/components/ILIAS/Logging/classes/error/class.ilLoggerCronCleanErrorFiles.php
@@ -1,9 +1,5 @@
lng->loadLanguageModule('logging');
- $this->lng = $DIC->language();
- $this->lng->loadLanguageModule("logging");
+ global $DIC;
$this->settings = new ilSetting('log');
$this->error_settings = ilLoggingErrorSettings::getInstance();
}
diff --git a/components/ILIAS/Logging/classes/public/class.ilLoggerFactory.php b/components/ILIAS/Logging/classes/public/class.ilLoggerFactory.php
index 497d789f69ed..00633d33bd9a 100755
--- a/components/ILIAS/Logging/classes/public/class.ilLoggerFactory.php
+++ b/components/ILIAS/Logging/classes/public/class.ilLoggerFactory.php
@@ -28,6 +28,7 @@
use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;
use ILIAS\DI\Container;
use Monolog\Processor\PsrLogMessageProcessor;
+use ILIAS\Logging\LoggerFactory;
/**
* Logging factory
@@ -35,7 +36,7 @@
* @author Stefan Meyer
*
*/
-class ilLoggerFactory
+class ilLoggerFactory implements LoggerFactory
{
protected const DEFAULT_FORMAT = "[%suid%] [%datetime%] %channel%.%level_name%: %message% %context% %extra%\n";
@@ -45,8 +46,7 @@ class ilLoggerFactory
private static ?ilLoggerFactory $instance = null;
- private ilLoggingSettings $settings;
- protected Container $dic;
+ protected ?Container $dic;
private bool $enabled = false; //ToDo PHP8 Review: This is a private var never read only written and should probably be removed.
@@ -55,19 +55,21 @@ class ilLoggerFactory
*/
private array $loggers = array();
- protected function __construct(ilLoggingSettings $settings)
- {
+ protected function __construct(
+ private ilLoggingSettings $settings
+ ) {
global $DIC;
-
$this->dic = $DIC;
- $this->settings = $settings;
$this->enabled = $this->getSettings()->isEnabled();
}
- public static function getInstance(): ilLoggerFactory
+ public static function getInstance(?\ilLoggingSettings $settings = null): ilLoggerFactory
{
- if (!static::$instance instanceof ilLoggerFactory) {
+ if (is_null($settings)) {
$settings = ilLoggingDBSettings::getInstance();
+ static::$instance = null;
+ }
+ if (!static::$instance instanceof ilLoggerFactory) {
static::$instance = new ilLoggerFactory($settings);
}
return static::$instance;
diff --git a/components/ILIAS/Logging/service.xml b/components/ILIAS/Logging/service.xml
index 13cdbbe73f12..31e109a29e12 100755
--- a/components/ILIAS/Logging/service.xml
+++ b/components/ILIAS/Logging/service.xml
@@ -9,8 +9,5 @@
adm
-
-
-
diff --git a/components/ILIAS/Logging/src/LoggerFactory.php b/components/ILIAS/Logging/src/LoggerFactory.php
new file mode 100644
index 000000000000..e99d9ffe4cb9
--- /dev/null
+++ b/components/ILIAS/Logging/src/LoggerFactory.php
@@ -0,0 +1,26 @@
+
new Component\Resource\ComponentJS($this, "ilMailComposeFunctions.js");
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilMailCronNotification(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilMailCronOrphanedMails(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/Mail/classes/class.ilMailCronNotification.php b/components/ILIAS/Mail/classes/class.ilMailCronNotification.php
index 27657ec9d09e..21fa5725397c 100755
--- a/components/ILIAS/Mail/classes/class.ilMailCronNotification.php
+++ b/components/ILIAS/Mail/classes/class.ilMailCronNotification.php
@@ -28,17 +28,17 @@
class ilMailCronNotification extends ilCronJob
{
private GlobalHttpState $http;
- protected ilLanguage $lng;
protected ilSetting $settings;
protected bool $initDone = false;
- protected function init(): void
+ public function init(): void
{
+ $this->lng->loadLanguageModule('mail');
+
global $DIC;
if (!$this->initDone) {
$this->settings = $DIC->settings();
- $this->lng = $DIC->language();
$this->http = $DIC->http();
$this->initDone = true;
@@ -52,17 +52,11 @@ public function getId(): string
public function getTitle(): string
{
- $this->init();
-
return $this->lng->txt('cron_mail_notification');
}
public function getDescription(): string
{
- $this->init();
-
- $this->lng->loadLanguageModule('mail');
-
return sprintf(
$this->lng->txt('cron_mail_notification_desc'),
$this->lng->txt('mail_allow_external')
diff --git a/components/ILIAS/Mail/classes/class.ilMailCronOrphanedMails.php b/components/ILIAS/Mail/classes/class.ilMailCronOrphanedMails.php
index 01701a192db1..8710039dbeb9 100755
--- a/components/ILIAS/Mail/classes/class.ilMailCronOrphanedMails.php
+++ b/components/ILIAS/Mail/classes/class.ilMailCronOrphanedMails.php
@@ -36,20 +36,18 @@ class ilMailCronOrphanedMails extends ilCronJob
{
private GlobalHttpState $http;
private Refinery $refinery;
- private ilLanguage $lng;
private ilSetting $settings;
private ilDBInterface $db;
private ilObjUser $user;
private bool $initDone = false;
private ilCronManager $cron_manager;
- private function init(): void
+ public function init(): void
{
global $DIC;
if (!$this->initDone) {
$this->settings = $DIC->settings();
- $this->lng = $DIC->language();
$this->db = $DIC->database();
$this->user = $DIC->user();
$this->http = $DIC->http();
@@ -91,13 +89,11 @@ public function getId(): string
public function getTitle(): string
{
- $this->init();
return $this->lng->txt('mail_orphaned_mails');
}
public function getDescription(): string
{
- $this->init();
return $this->lng->txt('mail_orphaned_mails_desc');
}
diff --git a/components/ILIAS/Mail/service.xml b/components/ILIAS/Mail/service.xml
index c1919cdeb647..80122b01f2fa 100755
--- a/components/ILIAS/Mail/service.xml
+++ b/components/ILIAS/Mail/service.xml
@@ -10,10 +10,6 @@
adm
-
-
-
-
diff --git a/components/ILIAS/Membership/Membership.php b/components/ILIAS/Membership/Membership.php
index b43c82b90d66..ad24df70e387 100644
--- a/components/ILIAS/Membership/Membership.php
+++ b/components/ILIAS/Membership/Membership.php
@@ -32,6 +32,18 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
- // ...
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilMembershipCronMinMembers(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class],
+ );
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilMembershipCronNotifications(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class],
+ );
+
}
}
diff --git a/components/ILIAS/Membership/classes/Cron/class.ilMembershipCronMinMembers.php b/components/ILIAS/Membership/classes/Cron/class.ilMembershipCronMinMembers.php
index e214ba53f0b0..2b44e065c573 100755
--- a/components/ILIAS/Membership/classes/Cron/class.ilMembershipCronMinMembers.php
+++ b/components/ILIAS/Membership/classes/Cron/class.ilMembershipCronMinMembers.php
@@ -1,9 +1,5 @@
lng = $DIC->language();
- }
-
public function getId(): string
{
return "mem_min_members";
diff --git a/components/ILIAS/Membership/classes/Cron/class.ilMembershipCronNotifications.php b/components/ILIAS/Membership/classes/Cron/class.ilMembershipCronNotifications.php
index a673e9b83b00..99ab4877e356 100755
--- a/components/ILIAS/Membership/classes/Cron/class.ilMembershipCronNotifications.php
+++ b/components/ILIAS/Membership/classes/Cron/class.ilMembershipCronNotifications.php
@@ -1,9 +1,5 @@
lng = $DIC->language();
$this->db = $DIC->database();
$this->logger = $DIC->logger()->mmbr();
$this->tree = $DIC->repositoryTree();
diff --git a/components/ILIAS/Membership/classes/Cron/class.ilMembershipCronNotificationsData.php b/components/ILIAS/Membership/classes/Cron/class.ilMembershipCronNotificationsData.php
index 03246f6a12ef..a8c606848245 100755
--- a/components/ILIAS/Membership/classes/Cron/class.ilMembershipCronNotificationsData.php
+++ b/components/ILIAS/Membership/classes/Cron/class.ilMembershipCronNotificationsData.php
@@ -1,9 +1,5 @@
-
-
-
-
diff --git a/components/ILIAS/MetaData/MetaData.php b/components/ILIAS/MetaData/MetaData.php
index 7fc312612276..a16d66d9bbd9 100644
--- a/components/ILIAS/MetaData/MetaData.php
+++ b/components/ILIAS/MetaData/MetaData.php
@@ -42,5 +42,13 @@ public function init(
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\Endpoint($this, "oai.php");
+
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilCronOerHarvester(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
+
}
}
diff --git a/components/ILIAS/MetaData/classes/class.ilCronOerHarvester.php b/components/ILIAS/MetaData/classes/class.ilCronOerHarvester.php
index c026983043ec..55c2da8472e9 100755
--- a/components/ILIAS/MetaData/classes/class.ilCronOerHarvester.php
+++ b/components/ILIAS/MetaData/classes/class.ilCronOerHarvester.php
@@ -33,18 +33,15 @@ class ilCronOerHarvester extends ilCronJob
protected const DEFAULT_SCHEDULE_VALUE = 1;
private ilLogger $logger;
- private ilLanguage $lng;
private Initiator $initiator;
private SettingsInterface $settings;
- public function __construct()
+ public function init(): void
{
- global $DIC;
-
- $this->logger = $DIC->logger()->meta();
- $this->lng = $DIC->language();
$this->lng->loadLanguageModule('meta');
+ $this->logger = $this->logger_factory->getLogger('meta');
+ global $DIC;
$this->initiator = new Initiator($DIC);
$this->settings = $this->initiator->settings();
}
diff --git a/components/ILIAS/MetaData/service.xml b/components/ILIAS/MetaData/service.xml
index 47cd91d29cc2..76c5a1d3c82c 100755
--- a/components/ILIAS/MetaData/service.xml
+++ b/components/ILIAS/MetaData/service.xml
@@ -9,8 +9,5 @@
adm
-
-
-
diff --git a/components/ILIAS/OrgUnit/OrgUnit.php b/components/ILIAS/OrgUnit/OrgUnit.php
index b65df02e25d1..3ad2eee35550 100644
--- a/components/ILIAS/OrgUnit/OrgUnit.php
+++ b/components/ILIAS/OrgUnit/OrgUnit.php
@@ -38,5 +38,12 @@ public function init(
);
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "authority.js");
+
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilCronUpdateOrgUnitPaths(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/OrgUnit/classes/class.ilCronUpdateOrgUnitPaths.php b/components/ILIAS/OrgUnit/classes/class.ilCronUpdateOrgUnitPaths.php
index b25e5887beb3..ae6432307541 100755
--- a/components/ILIAS/OrgUnit/classes/class.ilCronUpdateOrgUnitPaths.php
+++ b/components/ILIAS/OrgUnit/classes/class.ilCronUpdateOrgUnitPaths.php
@@ -26,18 +26,6 @@
class ilCronUpdateOrgUnitPaths extends ilCronJob
{
public const ID = "orgunit_paths";
- protected ilDBInterface $db;
- protected ilLogger $log;
- protected ilTree $tree;
-
- private ilLanguage $lng;
-
- public function __construct()
- {
- global $DIC;
-
- $this->lng = $DIC->language();
- }
public function getId(): string
{
diff --git a/components/ILIAS/OrgUnit/module.xml b/components/ILIAS/OrgUnit/module.xml
index d0ddab88bad9..3336a696fbdd 100755
--- a/components/ILIAS/OrgUnit/module.xml
+++ b/components/ILIAS/OrgUnit/module.xml
@@ -23,7 +23,4 @@
-
-
-
-
+
diff --git a/components/ILIAS/Search/Search.php b/components/ILIAS/Search/Search.php
index bd999909464c..2964a8dce702 100644
--- a/components/ILIAS/Search/Search.php
+++ b/components/ILIAS/Search/Search.php
@@ -36,5 +36,11 @@ public function init(
new Component\Resource\ComponentJS($this, "SearchMainMenu.js");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "Search.js");
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilLuceneIndexer(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/Search/classes/Lucene/class.ilLuceneIndexer.php b/components/ILIAS/Search/classes/Lucene/class.ilLuceneIndexer.php
index beeddd62fe96..3d051eb19c19 100755
--- a/components/ILIAS/Search/classes/Lucene/class.ilLuceneIndexer.php
+++ b/components/ILIAS/Search/classes/Lucene/class.ilLuceneIndexer.php
@@ -1,7 +1,22 @@
lng = $DIC->language();
$this->setting = $DIC->settings();
}
diff --git a/components/ILIAS/Search/service.xml b/components/ILIAS/Search/service.xml
index 1932c03249b6..2eee4dc6ec6b 100755
--- a/components/ILIAS/Search/service.xml
+++ b/components/ILIAS/Search/service.xml
@@ -14,8 +14,5 @@
-
-
-
diff --git a/components/ILIAS/Skill/Skill.php b/components/ILIAS/Skill/Skill.php
index 14809de6b706..b76d446c447a 100644
--- a/components/ILIAS/Skill/Skill.php
+++ b/components/ILIAS/Skill/Skill.php
@@ -38,5 +38,12 @@ public function init(
);
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "SkillEntries.js");
+
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilSkillNotifications(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/Skill/classes/class.ilSkillNotifications.php b/components/ILIAS/Skill/classes/class.ilSkillNotifications.php
index e3372acc0ad5..4b2ebe2f7e36 100755
--- a/components/ILIAS/Skill/classes/class.ilSkillNotifications.php
+++ b/components/ILIAS/Skill/classes/class.ilSkillNotifications.php
@@ -1,7 +1,5 @@
lng->loadLanguageModule("skll");
+
global $DIC;
- $this->lng = $DIC->language();
if (isset($DIC["ilUser"])) {
$this->user = $DIC->user();
}
@@ -59,16 +58,12 @@ public function getId(): string
public function getTitle(): string
{
- $lng = $this->lng;
- $lng->loadLanguageModule("skll");
- return $lng->txt("skll_skill_notification");
+ return $this->lng->txt("skll_skill_notification");
}
public function getDescription(): string
{
- $lng = $this->lng;
- $lng->loadLanguageModule("skll");
- return $lng->txt("skll_skill_notification_desc");
+ return $this->lng->txt("skll_skill_notification_desc");
}
public function getDefaultScheduleType(): CronJobScheduleType
diff --git a/components/ILIAS/Skill/service.xml b/components/ILIAS/Skill/service.xml
index 8379fd2e1879..c9097fddbd02 100755
--- a/components/ILIAS/Skill/service.xml
+++ b/components/ILIAS/Skill/service.xml
@@ -19,7 +19,4 @@
-
-
-
diff --git a/components/ILIAS/StudyProgramme/StudyProgramme.php b/components/ILIAS/StudyProgramme/StudyProgramme.php
index 29e04a00d8ea..56879a5eea47 100644
--- a/components/ILIAS/StudyProgramme/StudyProgramme.php
+++ b/components/ILIAS/StudyProgramme/StudyProgramme.php
@@ -38,5 +38,36 @@ public function init(
);
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentCSS($this, "css/ilStudyProgramme.css");
+
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilPrgInvalidateExpiredProgressesCronJob(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilPrgRestartAssignmentsCronJob(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilPrgUserNotRestartedCronJob(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilPrgUserRiskyToFailCronJob(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilPrgUpdateProgressCronJob(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/StudyProgramme/classes/class.ilPrgInvalidateExpiredProgressesCronJob.php b/components/ILIAS/StudyProgramme/classes/class.ilPrgInvalidateExpiredProgressesCronJob.php
index 878ed71e05be..2842f49a5118 100755
--- a/components/ILIAS/StudyProgramme/classes/class.ilPrgInvalidateExpiredProgressesCronJob.php
+++ b/components/ILIAS/StudyProgramme/classes/class.ilPrgInvalidateExpiredProgressesCronJob.php
@@ -32,16 +32,14 @@ class ilPrgInvalidateExpiredProgressesCronJob extends ilCronJob
private const ID = 'prg_invalidate_expired_progresses';
protected ilComponentLogger $log;
- protected ilLanguage $lng;
protected ilPRGAssignmentDBRepository $assignment_repo;
protected ilStudyProgrammeSettingsDBRepository $settings_repo;
- public function __construct()
+
+ public function init(): void
{
- global $DIC;
- $this->log = $DIC['ilLog'];
- $this->lng = $DIC['lng'];
$this->lng->loadLanguageModule('prg');
+ $this->log = $this->logger_factory->getLogger('prg');
$dic = ilStudyProgrammeDIC::dic();
$this->assignment_repo = $dic['repo.assignment'];
diff --git a/components/ILIAS/StudyProgramme/classes/class.ilPrgRestartAssignmentsCronJob.php b/components/ILIAS/StudyProgramme/classes/class.ilPrgRestartAssignmentsCronJob.php
index 5dd612b0e018..b9ab171a2a48 100755
--- a/components/ILIAS/StudyProgramme/classes/class.ilPrgRestartAssignmentsCronJob.php
+++ b/components/ILIAS/StudyProgramme/classes/class.ilPrgRestartAssignmentsCronJob.php
@@ -31,18 +31,15 @@ class ilPrgRestartAssignmentsCronJob extends ilCronJob
private const ACTING_USR_ID = ilPRGAssignment::AUTO_ASSIGNED_BY_RESTART;
protected ilComponentLogger $log;
- protected ilLanguage $lng;
protected ilPRGAssignmentDBRepository $assignment_repo;
protected ilPrgCronJobAdapter $adapter;
protected array $prgs = [];
- public function __construct()
+ public function init(): void
{
- global $DIC;
- $this->log = $DIC['ilLog'];
- $this->lng = $DIC['lng'];
$this->lng->loadLanguageModule('prg');
+ $this->log = $this->logger_factory->getLogger('prg');
$dic = ilStudyProgrammeDIC::dic();
$this->assignment_repo = $dic['repo.assignment'];
diff --git a/components/ILIAS/StudyProgramme/classes/class.ilPrgUpdateProgressCronJob.php b/components/ILIAS/StudyProgramme/classes/class.ilPrgUpdateProgressCronJob.php
index 558fabf1ac45..dabae47ab0bf 100755
--- a/components/ILIAS/StudyProgramme/classes/class.ilPrgUpdateProgressCronJob.php
+++ b/components/ILIAS/StudyProgramme/classes/class.ilPrgUpdateProgressCronJob.php
@@ -1,7 +1,5 @@
lng = $DIC['lng'];
$this->lng->loadLanguageModule('prg');
$dic = ilStudyProgrammeDIC::dic();
diff --git a/components/ILIAS/StudyProgramme/classes/class.ilPrgUserNotRestartedCronJob.php b/components/ILIAS/StudyProgramme/classes/class.ilPrgUserNotRestartedCronJob.php
index d2e54e408617..ccab74a414e7 100755
--- a/components/ILIAS/StudyProgramme/classes/class.ilPrgUserNotRestartedCronJob.php
+++ b/components/ILIAS/StudyProgramme/classes/class.ilPrgUserNotRestartedCronJob.php
@@ -1,7 +1,5 @@
log = $DIC['ilLog'];
- $this->lng = $DIC['lng'];
$this->lng->loadLanguageModule('prg');
+ $this->log = $this->logger_factory->getLogger('prg');
$dic = ilStudyProgrammeDIC::dic();
$this->assignment_repo = $dic['repo.assignment'];
diff --git a/components/ILIAS/StudyProgramme/classes/class.ilPrgUserRiskyToFailCronJob.php b/components/ILIAS/StudyProgramme/classes/class.ilPrgUserRiskyToFailCronJob.php
index db5e8fa1d77f..8c1707037c14 100755
--- a/components/ILIAS/StudyProgramme/classes/class.ilPrgUserRiskyToFailCronJob.php
+++ b/components/ILIAS/StudyProgramme/classes/class.ilPrgUserRiskyToFailCronJob.php
@@ -1,9 +1,5 @@
log = $DIC['ilLog'];
- $this->lng = $DIC['lng'];
$this->lng->loadLanguageModule('prg');
+ $this->log = $this->logger_factory->getLogger('prg');
$dic = ilStudyProgrammeDIC::dic();
$this->assignment_repo = $dic['repo.assignment'];
diff --git a/components/ILIAS/StudyProgramme/module.xml b/components/ILIAS/StudyProgramme/module.xml
index c3a5b546c010..1d5a1d883405 100755
--- a/components/ILIAS/StudyProgramme/module.xml
+++ b/components/ILIAS/StudyProgramme/module.xml
@@ -43,13 +43,6 @@
-
-
-
-
-
-
-
diff --git a/components/ILIAS/Survey/Survey.php b/components/ILIAS/Survey/Survey.php
index ad72be6ccc39..0e8cec9509fd 100644
--- a/components/ILIAS/Survey/Survey.php
+++ b/components/ILIAS/Survey/Survey.php
@@ -34,5 +34,11 @@ public function init(
): void {
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentCSS($this, "survey.css");
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilSurveyCronNotification(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/Survey/classes/class.ilSurveyCronNotification.php b/components/ILIAS/Survey/classes/class.ilSurveyCronNotification.php
index b497ba03d0f1..5a5a28ee7a0b 100755
--- a/components/ILIAS/Survey/classes/class.ilSurveyCronNotification.php
+++ b/components/ILIAS/Survey/classes/class.ilSurveyCronNotification.php
@@ -26,14 +26,11 @@
*/
class ilSurveyCronNotification extends ilCronJob
{
- protected ilLanguage $lng;
protected ilTree $tree;
- public function __construct()
+ public function init(): void
{
global $DIC;
-
- $this->lng = $DIC->language();
if (isset($DIC["tree"])) {
$this->tree = $DIC->repositoryTree();
}
diff --git a/components/ILIAS/Survey/module.xml b/components/ILIAS/Survey/module.xml
index ef12edb39b7d..302a1754b883 100755
--- a/components/ILIAS/Survey/module.xml
+++ b/components/ILIAS/Survey/module.xml
@@ -21,9 +21,6 @@
adm
-
-
-
diff --git a/components/ILIAS/SystemCheck/SystemCheck.php b/components/ILIAS/SystemCheck/SystemCheck.php
index fd0ea0f20f4c..99d4c2513017 100644
--- a/components/ILIAS/SystemCheck/SystemCheck.php
+++ b/components/ILIAS/SystemCheck/SystemCheck.php
@@ -32,6 +32,11 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
- // ...
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilSCCronTrash(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/SystemCheck/classes/class.ilSCCronTrash.php b/components/ILIAS/SystemCheck/classes/class.ilSCCronTrash.php
index 1a672f668066..a4ec49102a95 100755
--- a/components/ILIAS/SystemCheck/classes/class.ilSCCronTrash.php
+++ b/components/ILIAS/SystemCheck/classes/class.ilSCCronTrash.php
@@ -1,7 +1,5 @@
lng->loadLanguageModule('sysc');
- $this->lng = $DIC->language();
+ global $DIC;
$this->tree = $DIC->repositoryTree();
$this->objDefinition = $DIC['objDefinition'];
- $this->lng->loadLanguageModule('sysc');
}
public function getId(): string
diff --git a/components/ILIAS/SystemCheck/service.xml b/components/ILIAS/SystemCheck/service.xml
index 4bac44be71ff..7ea5cd687aac 100755
--- a/components/ILIAS/SystemCheck/service.xml
+++ b/components/ILIAS/SystemCheck/service.xml
@@ -7,8 +7,5 @@
adm
-
-
-
diff --git a/components/ILIAS/Test/Test.php b/components/ILIAS/Test/Test.php
index 866a38de18b7..ea183ba0a0ef 100644
--- a/components/ILIAS/Test/Test.php
+++ b/components/ILIAS/Test/Test.php
@@ -48,5 +48,11 @@ public function init(
new Component\Resource\ComponentCSS($this, "test_print.css");
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentCSS($this, "test_print_hide_content.css");
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilCronFinishUnfinishedTestPasses(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/Test/classes/class.ilCronFinishUnfinishedTestPasses.php b/components/ILIAS/Test/classes/class.ilCronFinishUnfinishedTestPasses.php
index d62456d89acd..5708b08eed52 100755
--- a/components/ILIAS/Test/classes/class.ilCronFinishUnfinishedTestPasses.php
+++ b/components/ILIAS/Test/classes/class.ilCronFinishUnfinishedTestPasses.php
@@ -30,12 +30,10 @@
*/
class ilCronFinishUnfinishedTestPasses extends ilCronJob
{
- protected readonly TestLogger $logger;
-
- protected readonly ilLanguage $lng;
- protected readonly ilDBInterface $db;
- protected readonly ilObjUser $user;
- protected readonly ilObjectDataCache $obj_data_cache;
+ protected TestLogger $logger;
+ protected ilDBInterface $db;
+ protected ilObjUser $user;
+ protected ilObjectDataCache $obj_data_cache;
protected int $now;
protected array $unfinished_passes;
protected array $test_ids;
@@ -43,15 +41,15 @@ class ilCronFinishUnfinishedTestPasses extends ilCronJob
protected ilTestProcessLockerFactory $processLockerFactory;
protected TestResultRepository $test_pass_result_repository;
- public function __construct()
+ public function init(): void
{
+ $this->lng->loadLanguageModule('assessment');
+
/** @var ILIAS\DI\Container $DIC */
global $DIC;
$this->logger = TestDIC::dic()['logging.logger'];
- $this->lng = $DIC['lng'];
$this->user = $DIC['ilUser'];
- $this->lng->loadLanguageModule('assessment');
$this->db = $DIC->database();
$this->obj_data_cache = $DIC['ilObjDataCache'];
$this->now = time();
diff --git a/components/ILIAS/Test/module.xml b/components/ILIAS/Test/module.xml
index b08137b7ad80..cb4e48da3cba 100755
--- a/components/ILIAS/Test/module.xml
+++ b/components/ILIAS/Test/module.xml
@@ -30,9 +30,6 @@
wfld
-
-
-
diff --git a/components/ILIAS/Test/tests/ilCronFinishUnfinishedTestPassesTest.php b/components/ILIAS/Test/tests/ilCronFinishUnfinishedTestPassesTest.php
index 00516db28fa8..30a204d159bb 100755
--- a/components/ILIAS/Test/tests/ilCronFinishUnfinishedTestPassesTest.php
+++ b/components/ILIAS/Test/tests/ilCronFinishUnfinishedTestPassesTest.php
@@ -19,6 +19,7 @@
declare(strict_types=1);
use ILIAS\Cron\Schedule\CronJobScheduleType;
+use ILIAS\Logging\LoggerFactory;
/**
* Class ilCronFinishUnfinishedTestPassesTest
@@ -40,7 +41,15 @@ protected function setUp(): void
define("ILIAS_LOG_ENABLED", false);
}
- $this->test_obj = new ilCronFinishUnfinishedTestPasses();
+ $logger_factory = $this->getMockBuilder(LoggerFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->test_obj = new ilCronFinishUnfinishedTestPasses(
+ 'components\ILIAS\Test',
+ $GLOBALS['lng'],
+ $logger_factory
+ );
}
public function test_instantiateObject_shouldReturnInstance(): void
@@ -63,8 +72,16 @@ public function testGetTitle(): void
->willReturn('testString')
;
+ $logger_factory = $this->getMockBuilder(LoggerFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
$this->setGlobalVariable('lng', $lng_mock);
- $test_obj = new ilCronFinishUnfinishedTestPasses();
+ $test_obj = new ilCronFinishUnfinishedTestPasses(
+ 'components\ILIAS\Test',
+ $GLOBALS['lng'],
+ $logger_factory
+ );
$this->assertEquals('testString', $test_obj->getTitle());
}
@@ -79,8 +96,16 @@ public function testGetDescription(): void
->willReturn('testString')
;
+ $logger_factory = $this->getMockBuilder(LoggerFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
$this->setGlobalVariable('lng', $lng_mock);
- $test_obj = new ilCronFinishUnfinishedTestPasses();
+ $test_obj = new ilCronFinishUnfinishedTestPasses(
+ 'components\ILIAS\Test',
+ $GLOBALS['lng'],
+ $logger_factory
+ );
$this->assertEquals('testString', $test_obj->getDescription());
}
diff --git a/components/ILIAS/Tracking/Tracking.php b/components/ILIAS/Tracking/Tracking.php
index b597fb4fe297..fd914d7d0797 100644
--- a/components/ILIAS/Tracking/Tracking.php
+++ b/components/ILIAS/Tracking/Tracking.php
@@ -39,5 +39,12 @@ public function init(
$contribute[SetupAgentInterface::class] = fn() => new SetupAgent($pull[Refinery::class]);
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, "ilObjStat.js");
+
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilLPCronObjectStatistics(
+ self::class,
+ $use[Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/Tracking/classes/class.ilLPCronObjectStatistics.php b/components/ILIAS/Tracking/classes/class.ilLPCronObjectStatistics.php
index 64e541aa9b70..05a39d4a813e 100755
--- a/components/ILIAS/Tracking/classes/class.ilLPCronObjectStatistics.php
+++ b/components/ILIAS/Tracking/classes/class.ilLPCronObjectStatistics.php
@@ -28,20 +28,17 @@
class ilLPCronObjectStatistics extends ilCronJob
{
protected int $date = 0;
-
- protected ilLanguage $lng;
protected ilDBInterface $db;
protected ilTree $tree;
protected ilLogger $logger;
protected ilCronManager $cron_manager;
- public function __construct()
+ public function init(): void
{
- global $DIC;
+ $this->lng->loadLanguageModule('trac');
+ $this->logger = $this->logger_factory->getLogger('trac');
- $this->logger = $DIC->logger()->trac();
- $this->lng = $DIC->language();
- $this->lng->loadLanguageModule("trac");
+ global $DIC;
$this->db = $DIC->database();
$this->tree = $DIC->repositoryTree();
$this->cron_manager = $DIC->cron()->manager();
diff --git a/components/ILIAS/Tracking/service.xml b/components/ILIAS/Tracking/service.xml
index 9803e32764fe..358d71cc0eb4 100755
--- a/components/ILIAS/Tracking/service.xml
+++ b/components/ILIAS/Tracking/service.xml
@@ -17,8 +17,5 @@
-
-
-
diff --git a/components/ILIAS/User/User.php b/components/ILIAS/User/User.php
index b1ea29a8da1d..f4e8450f234f 100644
--- a/components/ILIAS/User/User.php
+++ b/components/ILIAS/User/User.php
@@ -21,7 +21,6 @@
namespace ILIAS;
use ILIAS\User\Setup\Agent;
-
use ILIAS\Setup\Agent as SetupAgent;
use ILIAS\Refinery\Factory as Refinery;
@@ -41,5 +40,30 @@ public function init(
new Agent(
$pull[Refinery::class]
);
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilCronDeleteInactiveUserAccounts(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilCronDeleteInactivatedUserAccounts(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilUserCronCheckAccounts(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilCronDeleteNeverLoggedInUserAccounts(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
+
}
}
diff --git a/components/ILIAS/User/classes/Cron/class.ilCronDeleteInactivatedUserAccounts.php b/components/ILIAS/User/classes/Cron/class.ilCronDeleteInactivatedUserAccounts.php
index 8547b0f0846c..7af9792f210b 100755
--- a/components/ILIAS/User/classes/Cron/class.ilCronDeleteInactivatedUserAccounts.php
+++ b/components/ILIAS/User/classes/Cron/class.ilCronDeleteInactivatedUserAccounts.php
@@ -33,14 +33,15 @@ class ilCronDeleteInactivatedUserAccounts extends ilCronJob
/** @var int[] */
private array $include_roles;
private ilSetting $settings;
- private Language $lng;
private ilRbacReview $rbac_review;
private ilObjectDataCache $objectDataCache;
private \ILIAS\HTTP\GlobalHttpState $http;
private \ILIAS\Refinery\Factory $refinery;
- public function __construct()
+ public function init(): void
{
+ $this->lng->loadLanguageModule('usr');
+
/** @var ILIAS\DI\Container $DIC */
global $DIC;
@@ -48,10 +49,6 @@ public function __construct()
$this->http = $DIC['http'];
}
- if (isset($DIC['lng'])) {
- $this->lng = $DIC['lng'];
- }
-
if (isset($DIC['refinery'])) {
$this->refinery = $DIC['refinery'];
}
diff --git a/components/ILIAS/User/classes/Cron/class.ilCronDeleteInactiveUserAccounts.php b/components/ILIAS/User/classes/Cron/class.ilCronDeleteInactiveUserAccounts.php
index 4a2ce608ea4e..22a4bddf6906 100755
--- a/components/ILIAS/User/classes/Cron/class.ilCronDeleteInactiveUserAccounts.php
+++ b/components/ILIAS/User/classes/Cron/class.ilCronDeleteInactiveUserAccounts.php
@@ -42,7 +42,6 @@ class ilCronDeleteInactiveUserAccounts extends ilCronJob
private array $include_roles;
private ilCronDeleteInactiveUserReminderMail $cron_delete_reminder_mail;
private ilSetting $settings;
- private Language $lng;
private ilComponentLogger $log;
private ilRbacReview $rbac_review;
private ilObjectDataCache $objectDataCache;
@@ -51,8 +50,11 @@ class ilCronDeleteInactiveUserAccounts extends ilCronJob
private ilCronJobRepository $cronRepository;
private \ilGlobalTemplateInterface $main_tpl;
- public function __construct()
+ public function init(): void
{
+ $this->lng->loadLanguageModule('usr');
+ $this->log = $this->logger_factory->getRootLogger();
+
/** @var ILIAS\DI\Container $DIC */
global $DIC;
@@ -67,14 +69,6 @@ public function __construct()
$this->http = $DIC['http'];
}
- if (isset($DIC['lng'])) {
- $this->lng = $DIC['lng'];
- }
-
- if (isset($DIC['ilLog'])) {
- $this->log = $DIC['ilLog'];
- }
-
if (isset($DIC['refinery'])) {
$this->refinery = $DIC['refinery'];
}
@@ -259,7 +253,7 @@ private function deleteUserOrSendReminderMail($usr_id): int
if ($this->reminder_period > 0) {
$timestamp_for_deletion = $timestamp_last_login - $grace_period_over;
$account_will_be_deleted_on = $this->calculateDeletionData($timestamp_for_deletion);
- if(
+ if (
$this->cron_delete_reminder_mail->sendReminderMailIfNeeded(
$user,
$this->reminder_period,
diff --git a/components/ILIAS/User/classes/Cron/class.ilCronDeleteNeverLoggedInUserAccounts.php b/components/ILIAS/User/classes/Cron/class.ilCronDeleteNeverLoggedInUserAccounts.php
index ef2abff39eb4..046aa79df89f 100755
--- a/components/ILIAS/User/classes/Cron/class.ilCronDeleteNeverLoggedInUserAccounts.php
+++ b/components/ILIAS/User/classes/Cron/class.ilCronDeleteNeverLoggedInUserAccounts.php
@@ -28,7 +28,6 @@ class ilCronDeleteNeverLoggedInUserAccounts extends \ilCronJob
private string $roleIdWhiteliste = '';
private int $thresholdInDays = self::DEFAULT_CREATION_THRESHOLD;
- private Language $lng;
private ilSetting $settings;
private ilRbacReview $rbacreview;
private ilObjectDataCache $objectDataCache;
@@ -36,8 +35,10 @@ class ilCronDeleteNeverLoggedInUserAccounts extends \ilCronJob
private \ILIAS\Refinery\Factory $refinery;
private \ilGlobalTemplateInterface $main_tpl;
- public function __construct()
+ public function init(): void
{
+ $this->lng->loadLanguageModule('usr');
+
global $DIC;
$this->main_tpl = $DIC->ui()->mainTemplate();
@@ -56,11 +57,6 @@ public function __construct()
);
}
- if (isset($DIC['lng'])) {
- $this->lng = $DIC->language();
- $this->lng->loadLanguageModule('usr');
- }
-
if (isset($DIC['rbacreview'])) {
$this->rbacreview = $DIC->rbac()->review();
}
diff --git a/components/ILIAS/User/classes/Cron/class.ilUserCronCheckAccounts.php b/components/ILIAS/User/classes/Cron/class.ilUserCronCheckAccounts.php
index 93e361a63280..48dc36cc9eb4 100755
--- a/components/ILIAS/User/classes/Cron/class.ilUserCronCheckAccounts.php
+++ b/components/ILIAS/User/classes/Cron/class.ilUserCronCheckAccounts.php
@@ -29,25 +29,19 @@ class ilUserCronCheckAccounts extends ilCronJob
protected int $counter = 0;
private ilDBInterface $db;
- private ilLanguage $lng;
private ilComponentLogger $log;
- public function __construct()
+ public function init(): void
{
+ $this->lng->loadLanguageModule('usr');
+ $this->log = $this->logger_factory->getRootLogger();
+
/** @var ILIAS\DI\Container $DIC */
global $DIC;
if (isset($DIC['ilDB'])) {
$this->db = $DIC['ilDB'];
}
-
- if (isset($DIC['lng'])) {
- $this->lng = $DIC['lng'];
- }
-
- if (isset($DIC['ilDB'])) {
- $this->log = $DIC['ilLog'];
- }
}
public function getId(): string
diff --git a/components/ILIAS/User/service.xml b/components/ILIAS/User/service.xml
index 92221d63de87..fecf8a1fcc1f 100755
--- a/components/ILIAS/User/service.xml
+++ b/components/ILIAS/User/service.xml
@@ -22,12 +22,6 @@
-
-
-
-
-
-
diff --git a/components/ILIAS/WOPI/WOPI.php b/components/ILIAS/WOPI/WOPI.php
index 25474b5063e0..06d17bb8de7c 100644
--- a/components/ILIAS/WOPI/WOPI.php
+++ b/components/ILIAS/WOPI/WOPI.php
@@ -49,5 +49,12 @@ public function init(
$contribute[PublicAsset::class] = fn(): ComponentJS =>
new ComponentJS($this, "js/dist/wopi.min.js");
+
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilWOPICrawler(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
}
}
diff --git a/components/ILIAS/WOPI/classes/Cron/class.ilWOPICrawler.php b/components/ILIAS/WOPI/classes/Cron/class.ilWOPICrawler.php
index 6be7766735b8..63df938bf0fd 100755
--- a/components/ILIAS/WOPI/classes/Cron/class.ilWOPICrawler.php
+++ b/components/ILIAS/WOPI/classes/Cron/class.ilWOPICrawler.php
@@ -31,20 +31,18 @@
*/
class ilWOPICrawler extends ilCronJob
{
- private ilLanguage $language;
private ilSetting $settings;
private Crawler $crawler;
private AppRepository $app_repository;
private ActionRepository $action_repository;
- public function __construct()
+ public function init(): void
{
+ $this->lng->loadLanguageModule('wopi');
+
global $DIC;
- $this->language = $DIC->language();
- $this->language->loadLanguageModule('wopi');
$this->settings = $DIC->settings();
$this->crawler = new Crawler();
-
$this->app_repository = new AppDBRepository($DIC->database());
$this->action_repository = new ActionDBRepository($DIC->database());
}
@@ -56,12 +54,12 @@ public function getId(): string
public function getTitle(): string
{
- return $this->language->txt('wopi_crawler_cronjob_title');
+ return $this->lng->txt('wopi_crawler_cronjob_title');
}
public function getDescription(): string
{
- return $this->language->txt('wopi_crawler_cronjob_description');
+ return $this->lng->txt('wopi_crawler_cronjob_description');
}
public function hasAutoActivation(): bool
diff --git a/components/ILIAS/WOPI/service.xml b/components/ILIAS/WOPI/service.xml
index 8e4540c995cf..70ce5def2865 100755
--- a/components/ILIAS/WOPI/service.xml
+++ b/components/ILIAS/WOPI/service.xml
@@ -1,7 +1,4 @@
-
-
-
diff --git a/components/ILIAS/WebServices/WebServices.php b/components/ILIAS/WebServices/WebServices.php
index 6ae160704ecf..6a908208b846 100644
--- a/components/ILIAS/WebServices/WebServices.php
+++ b/components/ILIAS/WebServices/WebServices.php
@@ -41,5 +41,13 @@ public function init(
new \ilECSAgent(
$pull[\ILIAS\Refinery\Factory::class]
);
+
+ $contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
+ new \ilCronEcsTaskScheduler(
+ self::class,
+ $use[\ILIAS\Language\Language::class],
+ $use[\ILIAS\Logging\LoggerFactory::class]
+ );
+
}
}
diff --git a/components/ILIAS/WebServices/classes/class.ilCronEcsTaskScheduler.php b/components/ILIAS/WebServices/classes/class.ilCronEcsTaskScheduler.php
index d5325edad04b..ac822661c332 100755
--- a/components/ILIAS/WebServices/classes/class.ilCronEcsTaskScheduler.php
+++ b/components/ILIAS/WebServices/classes/class.ilCronEcsTaskScheduler.php
@@ -1,6 +1,20 @@
logger = $DIC->logger()->wsrv();
- $this->lng = $DIC->language();
$this->lng->loadLanguageModule('ecs');
+ global $DIC;
+ $this->logger = $DIC->logger()->wsrv();
$this->result = new \ilCronJobResult();
}
diff --git a/components/ILIAS/WebServices/service.xml b/components/ILIAS/WebServices/service.xml
index 6196f8e25a90..81ba86b9d9ec 100755
--- a/components/ILIAS/WebServices/service.xml
+++ b/components/ILIAS/WebServices/service.xml
@@ -15,9 +15,6 @@
-
-
-