|
| setThreshold ($t) |
|
| setConfig (FannieConfig $fc) |
|
| setLogger ($fl) |
|
| setOptions ($o) |
|
| setArguments ($a) |
|
| testMode ($t) |
|
| run () |
|
| cronMsg ($str, $severity=6) |
|
| lazyGetOpt ($argv) |
|
|
| $name = 'Fannie Task' |
|
| $description = 'Information about the task' |
|
| $default_schedule |
|
| $schedulable = true |
|
| $log_start_stop = true |
|
const | TASK_NO_ERROR = 0 |
|
const | TASK_TRIVIAL_ERROR = 1 |
|
const | TASK_SMALL_ERROR = 2 |
|
const | TASK_MEDIUM_ERROR = 3 |
|
const | TASK_LARGE_ERROR = 4 |
|
const | TASK_WORST_ERROR = 5 |
|
|
| $error_threshold = 99 |
|
| $config = null |
|
| $logger = null |
|
| $options = array() |
|
| $arguments = array() |
|
| $test_mode = false |
|
Base class for scheduled tasks
FannieTask::cronMsg |
( |
|
$str, |
|
|
|
$severity = 6 |
|
) |
| |
Write message to log and if necessary raise it to stderr to trigger an email
- Parameters
-
$str | message string |
$severity | [optional, default 6/info] message importance |
- Returns
- empty string
FannieTask::lazyGetOpt |
( |
|
$argv | ) |
|
getopt style parsing. not fully posix compliant.
- Parameters
-
$argv | [array] of options and arguments |
- Returns
- [array]
- options [array] of option names and values
- arguments [array] of non-option arguments
Example: php FannieTask.php SomeTask -v –verbose -h 1 –host=1 something else
lazyGetOpt returns
- options "-v" => true "--verbose" => true "-h" => 1 "--host" => 1
- arguments 0 => "something" 1 => "else"
Implement task functionality here
FannieTask::$default_schedule |
Initial value:= array(
'min' => 0,
'hour' => 0,
'day' => 1,
'month' => 1,
'weekday' => '*',
)
FannieTask::$log_start_stop = true |
Normally the start and stop time of a task is automatically logged. This can be helpful to verify a task a) actually ran and b) completed without crashing. However for tasks that run very frequently this can generate excess log noise.
The documentation for this class was generated from the following file:
- fannie/classlib2.0/FannieTask.php