Cronjobs#
Cronjobs offer an easy way to execute actions periodically, like cleaning up the database.
The execution of cronjobs is not guaranteed but requires someone to access the page with JavaScript enabled.
This page focuses on the technical aspects of cronjobs, the cronjob package installation plugin page covers how you can actually register a cronjob.
Example#
ICronjob
Interface#
Every cronjob needs to implement the wcf\system\cronjob\ICronjob
interface which requires the execute(Cronjob $cronjob)
method to be implemented.
This method is called by wcf\system\cronjob\CronjobScheduler when executing the cronjobs.
In practice, however, you should extend the AbstractCronjob
class and also call the AbstractCronjob::execute()
method as it fires an event which makes cronjobs extendable by plugins (see event documentation).