Skip to content

Commit bf5ad41

Browse files
committed
Cron: update readme
1 parent 99e974b commit bf5ad41

1 file changed

Lines changed: 23 additions & 18 deletions

File tree

components/ILIAS/Cron/README.md

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,32 @@ described in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt).
2121
## Implementing and Configuring a Cron-Job
2222

2323
To give more control of if and when cron-jobs are executed to administrators a 2nd implementation of cron-jobs
24-
has been added to ILIAS 4.4+. All existing cron-jobs have been migrated and thus moved to their respective modules
25-
and services. The top-level directory "cron/" will probably be kept because of cron.php but should otherwise be empty
26-
at some point.
24+
has been added to ILIAS 4.4+. All existing cron-jobs have been migrated and thus moved to their respective component.
25+
The top-level directory "cron/" was removed.
2726

2827
### Providing a Cron-Job
2928

30-
A module or service has to "announce" its cron-jobs to the system by adding them to their respective
31-
module.xml or service.xml.
32-
33-
- The job id has to be unique.
34-
- An optional path can be added if the module/service directory layout differs from the ILIAS standard.
35-
29+
A component has to contribute its cron-jobs to the system in its Component-class:
3630
```php
37-
<?xml version = "1.0" encoding = "UTF-8"?>
38-
<service xmlns="http://www.w3.org" version="$Id$"
39-
id="trac">
40-
...
41-
<crons>
42-
<cron id="lp_object_statistics" class="ilLPCronObjectStatistics" />
43-
</crons>
44-
</service>
31+
class MyComponent implements Component\Component
32+
{
33+
public function init(
34+
array | \ArrayAccess &$define,
35+
array | \ArrayAccess &$implement,
36+
array | \ArrayAccess &$use,
37+
array | \ArrayAccess &$contribute,
38+
array | \ArrayAccess &$seek,
39+
array | \ArrayAccess &$provide,
40+
array | \ArrayAccess &$pull,
41+
array | \ArrayAccess &$internal,
42+
): void {
43+
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
44+
new \MyComponentCronJob(
45+
'components\\' . self::class,
46+
$use[\ILIAS\Language\Language::class]
47+
);
48+
}
49+
}
4550
```
4651

4752
There are 3 basic concepts: cron-job, schedule and cron-result. Using them as intended should make testing
@@ -176,7 +181,7 @@ So as mentioned above the cron-tab can safely be set to every few minutes.
176181
In order to execute the cron job manager, the following command MUST be used:
177182

178183
```shell
179-
/usr/bin/php [PATH_TO_ILIAS]/cron/cron.php run-jobs <user> <client_id> run-jobs
184+
/usr/bin/php [PATH_TO_ILIAS]/cli/cron.php run-jobs <user> <client_id>
180185
```
181186

182187
The `<user>` MUST be a valid (but arbitrary) user account of the ILIAS installation.

0 commit comments

Comments
 (0)