\Horde_Scheduler_Cron

Horde_Scheduler_cron:: Sort of a cron replacement in a PHP cli script.

Date Syntax Examples.

Remember:

  • Whitespace (space, tab, newline) delimited fields
  • Single values, sets, ranges, wildcards

SECOND MINUTE HOUR DAY MONTH

          • (every second) 0,30 (every 30 seconds) 0 0,10,20,30,40,50 (every 10 minutes) 0 0 (beginning of every hour) 0 0 0,6,12,18 (at midnight, 6am, noon, 6pm) 0 0 0 1-7&Fri (midnight, first Fri of the month) 0 0 0 1-7!Fri (midnight, first Mon-Thu,Sat-Sun of the month)

Example usage:

Summary

Methods
Properties
Constants
factory()
__construct()
run()
serialize()
unserialize()
sleep()
addTask()
removeTask()
runcmd()
$_counter
No constants found
No protected methods found
$_sleep
$_sleep_adj
$_tasks
N/A
No private methods found
No private properties found
N/A

Properties

$_counter

$_counter : integer

Every time a task is added it will get a fresh uid even if immediately removed.

Type

integer

$_sleep

$_sleep : string

Name of the sleep function.

Type

string

$_sleep_adj

$_sleep_adj : integer

Adjustment factor to sleep in microseconds.

Type

integer

$_tasks

$_tasks : array

TODO

Type

array

Methods

factory()

factory(string  $driver, array  $params = null) : \Horde_Scheduler

Attempts to return a concrete Horde_Scheduler instance based on $driver.

Parameters

string $driver

The type of concrete subclass to return.

array $params

A hash containing any additional configuration or connection parameters a subclass might need.

Throws

\Horde_Scheduler_Exception

Returns

\Horde_Scheduler

The newly created concrete instance.

__construct()

__construct() 

Constructor.

Figures out how we can best sleep with microsecond precision based on what platform we're running on.

run()

run() 

Main loop/action function.

serialize()

serialize(string  $id = '') : boolean

Preserve the internal state of the scheduler object that we are passed, and save it to the Horde VFS backend. Horde_Scheduler objects should define __sleep() and __wakeup() serialization callbacks for anything that needs to be done at object serialization or deserialization - handling database connections, etc.

Parameters

string $id

An id to uniquely identify this scheduler from others of the same class.

Returns

boolean —

Success result.

unserialize()

unserialize(string  $class, string  $id = '', boolean  $autosave = true) 

Restore a Horde_Scheduler object from the cache.

Parameters

string $class

The name of the object to restore.

string $id

An id to uniquely identify this scheduler from others of the same class.

boolean $autosave

Automatically store (serialize) the returned object at script shutdown.

sleep()

sleep(integer  $msec) 

Platform-independant sleep $msec microseconds.

Parameters

integer $msec

Microseconds to sleep.

addTask()

addTask(  $cmd,   $rules) 

Parameters

$cmd
$rules

removeTask()

removeTask(  $uid) 

Parameters

$uid

runcmd()

runcmd(  $task) 

Parameters

$task