Cronjobs offer an easy way to execute actions periodically, like cleaning up the database.
This page focuses on the technical aspects of cronjobs, the cronjob package installation plugin page covers how you can actually register a cronjob.
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).
Executing Cronjobs Through CLI#
Cronjobs can be executed through the command-line interface (CLI):
1 2 3 4 5