Skip to content

Commit ce5cac9

Browse files
committed
Cron: use component bootstrap/entry point for runner
1 parent 1e23281 commit ce5cac9

4 files changed

Lines changed: 6 additions & 20 deletions

File tree

cli/cron.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818

1919
declare(strict_types=1);
2020

21-
chdir(__DIR__);
22-
chdir('..');
21+
require_once __DIR__ . '/../vendor/composer/vendor/autoload.php';
22+
require_once __DIR__ . '/../artifacts/bootstrap_default.php';
2323

24-
require_once './vendor/composer/vendor/autoload.php';
24+
ilContext::init(ilContext::CONTEXT_CRON);
25+
26+
entry_point('ILIAS Legacy Initialisation Adapter');
2527

2628
$cron = new ILIAS\Cron\CLI\App(
2729
new ILIAS\Cron\CLI\Commands\RunActiveJobsCommand()

components/ILIAS/Cron/classes/class.ilCronJobEntity.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,9 @@ public function __construct(private readonly CronJob $job, array $record, privat
6060
*/
6161
private function mapRecord(CronJob $job, array $record): void
6262
{
63-
if (! array_key_exists('job_id', $record)) {
64-
//TODO: remove!
65-
var_dump($record);
66-
die();
67-
}
68-
//$this->jobId = (string) $record['job_id'];
69-
//$this->component = (string) $record['component'];
7063
$this->jobId = $job->getId();
7164
$this->component = $job->getComponent();
65+
7266
$this->scheduleType = is_numeric($record['schedule_type']) ? CronJobScheduleType::tryFrom((int) $record['schedule_type']) : null;
7367
$this->scheduleValue = (int) $record['schedule_value'];
7468
$this->jobStatus = (int) $record['job_status'];

components/ILIAS/Cron/classes/class.ilCronJobRepositoryImpl.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public function __construct(
3939

4040
public function getJobInstanceById(string $id): ?ilCronJob
4141
{
42-
4342
$jobs_data = $this->getCronJobData($id);
4443
if ($jobs_data !== [] && $jobs_data[0]['job_id'] === $id) {
4544
return $this->getJobInstance(
@@ -116,8 +115,6 @@ public function registerJob(
116115
if (!$this->db->tableExists('cron_job')) {
117116
return;
118117
}
119-
120-
//$job = $this->getJobInstance($a_id, $a_component, $a_class, true);
121118
$job = $this->getJobInstance($a_id, $a_component, $a_class);
122119
if ($job) {
123120
$this->createDefaultEntry($job, $a_component, $a_class, $a_path);

components/ILIAS/Cron/classes/class.ilCronStartUp.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ public function __construct(
2828
private readonly string $username,
2929
?ilAuthSession $authSession = null
3030
) {
31-
/** @noRector */
32-
ilContext::init(ilContext::CONTEXT_CRON);
33-
34-
// TODO @see mantis 20371: To get rid of this, the authentication service has to provide a mechanism to pass the client_id
35-
$_GET['client_id'] = $this->client;
36-
ilInitialisation::initILIAS();
37-
3831
if (null === $authSession) {
3932
global $DIC;
4033
$authSession = $DIC['ilAuthSession'];

0 commit comments

Comments
 (0)