Skip to content

Commit dbf4c54

Browse files
committed
Cron: minor adjustments
1 parent ce5cac9 commit dbf4c54

5 files changed

Lines changed: 7 additions & 22 deletions

File tree

components/ILIAS/Cron/classes/Setup/class.ilCronJobSetupAgent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
class ilCronJobSetupAgent implements Setup\Agent
2525
{
2626
public function __construct(
27-
private array $cronjobs
27+
private readonly array $cronjobs
2828
) {
2929
}
3030

components/ILIAS/Cron/classes/Setup/class.ilCronJobsRegisteredObjective.php

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,37 +23,25 @@
2323
class ilCronjobsRegisteredObjective implements Setup\Objective
2424
{
2525
public function __construct(
26-
private array $cronjobs
26+
private readonly array $cronjobs
2727
) {
2828
}
2929

30-
/**
31-
* @inheritdoc
32-
*/
3330
public function getHash(): string
3431
{
3532
return hash("sha256", self::class);
3633
}
3734

38-
/**
39-
* @inheritdoc
40-
*/
4135
public function getLabel(): string
4236
{
4337
return "CronJobs are registered.";
4438
}
4539

46-
/**
47-
* @inheritdoc
48-
*/
4940
public function isNotable(): bool
5041
{
5142
return true;
5243
}
5344

54-
/**
55-
* @inheritdoc
56-
*/
5745
public function getPreconditions(Setup\Environment $environment): array
5846
{
5947
return [
@@ -63,9 +51,6 @@ public function getPreconditions(Setup\Environment $environment): array
6351
];
6452
}
6553

66-
/**
67-
* @inheritdoc
68-
*/
6954
public function achieve(Setup\Environment $environment): Setup\Environment
7055
{
7156
$db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
@@ -107,9 +92,6 @@ public function achieve(Setup\Environment $environment): Setup\Environment
10792
return $environment;
10893
}
10994

110-
/**
111-
* @inheritdoc
112-
*/
11395
public function isApplicable(Setup\Environment $environment): bool
11496
{
11597
return true;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function registerJob(
123123

124124
public function unregisterAllJobs(): void
125125
{
126-
$query = 'TRUNCATE cron_job;';
126+
$query = 'DELETE FROM cron_job';
127127
$res = $this->db->manipulate($query);
128128
}
129129

components/ILIAS/Cron/interfaces/interface.ilCronJobRepository.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public function registerJob(string $a_component, string $a_id, string $a_class,
4141

4242
public function unregisterJob(string $a_component, array $a_xml_job_ids): void;
4343

44+
public function unregisterAllJobs(): void;
45+
4446
public function createDefaultEntry(ilCronJob $job, string $component, string $class, ?string $path): void;
4547

4648
/**
@@ -67,4 +69,5 @@ public function activateJob(ilCronJob $job, DateTimeImmutable $when, ilObjUser $
6769
public function deactivateJob(ilCronJob $job, DateTimeImmutable $when, ilObjUser $actor, bool $wasManuallyExecuted = false): void;
6870

6971
public function findAll(): ilCronJobCollection;
72+
7073
}

components/ILIAS/Cron/src/CronRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CronRegistry implements Registry
2626
* @param ilCronJob[] $jobs
2727
*/
2828
public function __construct(
29-
private array $jobs
29+
private readonly array $jobs
3030
) {
3131
}
3232

0 commit comments

Comments
 (0)