PHP Interface Newscoop\SchedulerServiceInterface

Afficher le fichier Open project: sourcefabric/newscoop Interface Usage Examples

Méthodes publiques

Méthode Description
addSchedulerJob ( string $jobName, array $config ) : void Add cron job to Jobby library directly, where job will be started based on given configuration parameters
getNextRunDate ( string $schedule, string | DateTime $currentTime = 'now', integer $nth, boolean $allowCurrentDate = false ) : string Get a next run date relative to the current date or a specific date
getPreviousRunDate ( string $schedule, string | DateTime $currentTime = 'now', integer $nth, boolean $allowCurrentDate = false ) : string Get a previous run date relative to the current date or a specific date
registerJob ( string $jobName, array $config ) : void Add cron job details to database
removeJob ( string $jobName, array $config ) : void Remove cron job from database
run ( ) : void Run Jobby manager which will start all enabled cronjobs

Method Details

addSchedulerJob() public méthode

Add cron job to Jobby library directly, where job will be started based on given configuration parameters
public addSchedulerJob ( string $jobName, array $config ) : void
$jobName string Job name
$config array Array with job configuration
Résultat void

getNextRunDate() public méthode

Get a next run date relative to the current date or a specific date
public getNextRunDate ( string $schedule, string | DateTime $currentTime = 'now', integer $nth, boolean $allowCurrentDate = false ) : string
$schedule string Cron job schedule expression
$currentTime string | DateTime (optional) Relative calculation date
$nth integer (optional) Number of matches to skip before returning a matching next run date. 0, the default, will return the current date and time if the next run date falls on the current date and time. Setting this value to 1 will skip the first match and go to the second match. Setting this value to 2 will skip the first 2 matches and so on.
$allowCurrentDate boolean (optional) Set to TRUE to return the current date if it matches the cron expression
Résultat string

getPreviousRunDate() public méthode

Get a previous run date relative to the current date or a specific date
public getPreviousRunDate ( string $schedule, string | DateTime $currentTime = 'now', integer $nth, boolean $allowCurrentDate = false ) : string
$schedule string Cron job schedule expression
$currentTime string | DateTime (optional) Relative calculation date
$nth integer (optional) Number of matches to skip before returning
$allowCurrentDate boolean (optional) Set to TRUE to return the current date if it matches the cron expression
Résultat string

registerJob() public méthode

Add cron job details to database
public registerJob ( string $jobName, array $config ) : void
$jobName string Cron job name
$config array Array with job configuration - string $command The job to run (either a shell command or anonymous PHP function) - string $schedule Crontab schedule format (`man -s 5 crontab`) - boolean $enabled Run this job at scheduled times - boolean $debug Send `jobby` internal messages to 'debug.log' - string $dateFormat Format for dates on `jobby` log messages - string $output Redirect `stdout` and `stderr` to this file - string $runOnHost Run jobs only on this hostname - string $environment Development environment for this job - string $runAs Run as this user, if crontab user has `sudo` privileges
Résultat void

removeJob() public méthode

Remove cron job from database
public removeJob ( string $jobName, array $config ) : void
$jobName string Cron job name
$config array Array with job configuration
Résultat void

run() public méthode

Run Jobby manager which will start all enabled cronjobs
public run ( ) : void
Résultat void