Plugins::cron
From ZenMagick Wiki
Contents |
Description
As the name suggests, this is a plugin to execute tasks in configurable intervals. There can be as many tasks (or cron jobs) as required, however depending on the system performance and the complexity of the jobs there will be practical limits.
Configuration and general ideas are taken from the cron deamon as found on most *unix systems.
Execution trigger
There are two different ways to trigger execution of the cron plugin.
- Using the system cron job (on *nix OS).
This requires to set up a single system cron job to call the CLI version of the plugin. - Injection of a 1x1px transparent image in store pages.
The list of pages that should be used is configurable. The advantage of this approach is that no system changes are required and execution will not really affect the performance of storefront pages.
Eventually there should also be a way to manually trigger execution from within the admin interface.
Other options
When using the image injection trigger, there is obviously no guarantee calling the plugin regularly. TO compensate for that, there is an option to specify what should happen to jobs that should have been run in the past. Either nothing happens at all and the job will be executed only if there is an exact match of the configured execution times. Alternatively, using the catch up mode, overdue jobs will be executed the next time cron is called.
Cron jobs
A cron job in the context of this plugin is a simple class that implements the ZMCronJob interface. This interface hasjsut a single method:
/**
* Execute the job.
*
* @return boolean The execution status.
*/
public function execute();
Everything else, like time management, history tracking (when was a job last run), etc is handled by the plugin.
For the cron job it doesn't make a difference which way it was triggered and, of course, it can use the full range of ZenMagick service classes, etc.

