Feature Wiki

Information about planned and released features

Tabs

Using CronJobs within PlugIns

With ILIAS 8 existing cron job plugins must add type hints and return type declarations for the `getCronJobInstances` and `getCronJobInstance`.

1 Initial Problem

  • Currently plug-ins can only be used for one function at a time.
  • If you want to connect general plug-in functions with a cron job, two different plug-ins are required.

2 Conceptual Summary

The aim is to expand the plug-in interface that cronjobs can be triggered with a feature plug-in.

3 User Interface Modifications

3.1 List of Affected Views

None

3.2 User Interface Details

None

3.3 New User Interface Concepts

None

4 Technical Information

There will be a new core interface:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
interface ilPluginCronJobProvider
{
/**
* @return ilCronJob[]
*/

public function getCronJobInstances() : array;
 
/**
* @param string $jobId
* @return ilCronJob
* @throws OutOfBoundsException if the passed argument does not match any cron job
*/

public function getCronJobInstance(string $jobId) : ilCronJob;
}

The abstract base class for all dedicated cron job plugins ilCronHookPlugin will implement this interface, so there won't be any compatibility issue with existing cron job plugins. Other plugins (of any kind) can optionally implement this interface to provider jobs.

5 Privacy Information

None

6 Security Implications

None

7 Contact

8 Funding

If you are interest in funding this feature, please add your name and institution to this list.

9 Discussion

JourFixe, ILIAS [jourfixe], 06 JUL 2020 : We highly appreciate this suggestion and schedule the feature for ILIAS 8.

10 Implementation

Implemented as described above. All types of plugins MAY implement the `ilCronJobProvider` interface and MAY provide their jobs accordingly.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
interface ilCronJobProvider
{
/**
* @return ilCronJob[]
*/

public function getCronJobInstances() : array;
 
/**
* @param string $jobId
* @return ilCronJob
* @throws OutOfBoundsException if the passed argument does not match any cron job
*/

public function getCronJobInstance(string $jobId) : ilCronJob;
}

Test Cases

Test cases completed at 2021-02-19 by Jansen, Michael [mjansen]

  • #42490 : Test-Plugin installieren
  • #42491 : Cron-Job ausführen

Approval

Approved at 2021-02-19 by Bromberger, Norbert [bromberger].

Last edited: 20. Feb 2021, 18:00, Jansen, Michael [mjansen]