User talk:Rickc

From Habari Project

Jump to: navigation, search

Creating a Cron Job

A cron job is a task that Habari performs on a periodic basis. You have the capacity to create cron jobs for Habari to run. The basic function used to create a cron job is

CronTab::add_cron( array( 'name' => '',
			'callback' => '',
			'next_run' => time(),
			'increment' => 86400, // one day
			'start_time' => time(),
			'end_time' => '',
			'cron_class' => self::CRON_CUSTOM,
			'description' => '',
			'notify' => '' ) );

name - the name of the cron job

callback - the name of the callback function the cron job will call to do the actual work

increment - how frequently you want the cron job to run (in seconds)

start_time - when you want the cron job to run for the first time

end_time - when you want the cron job to stop running, if ever. If the cron job contains an end time, it will delete itself after the last run

cron_class - this can have one of four values:

  • CronJob::CRON_SYSTEM
  • CronJob::CRON_THEME
  • CronJob::CRON_PLUGIN
  • CronJob::CRON_CUSTOM

description - A description of the cron job

notify - an email address to which to send notification of the success or failure of the cron job when it runs. Currently, this field isn't used.

Personal tools