39 Settings::setDefaultValue(
'scheduled_task',
'test_email',
'',
'String',
'Comma-separated list of recipients for the test task');
60 catch(DataNotFoundException $e)
64 $task->task_name = $task_name;
65 $task->active =
false;
66 $task->run_every_hour = $hourly;
73 $tabs = array(
"Task Schedule" =>
"/admin/scheduled_task_form",
74 "Execution Logs" =>
"/admin/scheduled_task_logs");
76 $qs = ($key) ?
"task_id=$key" :
"";
77 return new TabBar(
"tabs",
$tabs,
$qs);
85 return Query::create(
ScheduledTask,
"ORDER BY component, task_name")->execute();
95 trace(
"-- Executing Task '{$component}: $task_name'", 3);
108 $result = call_user_func($worker);
130 trace(
"** Running tasks for period $currentPeriod", 3);
137 if (!
$task->active)
continue;
138 if (
$task->run_every_hour || strpos(
$task->schedule, $currentPeriod) !==
false)
145 trace(
"$count ".pluralize(
"task",
$count).
" executed", 3);
158 trace(
"Running Validation Configuration task", 3);
171 trace(
"Sending confirmation email to {$email}", 3);
174 "This message confirms that the Validate Configuration schedule task worker was triggered at ".now(),
179 echo
"Confirmation email sent";
187 $mgr->upgrade($version);
static fireEvent($event, $parameter=null, $mustBeConsumed=false)
Fire an event to all subscribers as detailed in their manifests.
static coreTraceLevel()
Change to the configured trace level for Fakoli core code.
static scheduledTaskTraceLevel()
Changed to the configured trace level for scheduled task worker code.
static using()
Import the datamodels, views and manifest for the specified component(s).
static getInstance($component, $task_name)
Manages scheduled task registration and execution.
executeTask($component, $task_name)
Executes the specified scheduled task.
static registerScheduledTaskWorkers()
Registers a simple task that sends an email when triggered.
static testTask()
Provides the implementation of the test task, that can be used to validate the scheduled task server ...
runTasks()
Runs all the tasks that are scheduled to be run for the current period (day and hour).
getTasks()
Retrieves all the registered scheduled tasks.
__construct()
Creates a ScheduledTaskManager.
static registerWorker($component, $task_name, $handler, $hourly=false)
Registers a Scheduled Task worker method.
static upgradeComponent($version)
static getValue($component, $name)
Retrieve the value of the specified Setting.
static setDefaultValue($component, $name, $value, $field_type="String", $annotation="", $category="", $options="", $weight=0)
Sets the default value of the given component setting.
static calculatePeriod($datetime=null)