Zeile 11 | Zeile 11 |
---|
/** * Execute a scheduled task. *
|
/** * Execute a scheduled task. *
|
* @param int The task ID. If none specified, the next task due to be ran is executed
| * @param int $tid The task ID. If none specified, the next task due to be ran is executed
|
* @return boolean True if successful, false on failure */ function run_task($tid=0)
| * @return boolean True if successful, false on failure */ function run_task($tid=0)
|
Zeile 50 | Zeile 50 |
---|
{ $db->update_query("tasks", array("locked" => TIME_NOW), "tid='{$task['tid']}'"); }
|
{ $db->update_query("tasks", array("locked" => TIME_NOW), "tid='{$task['tid']}'"); }
|
| $file = basename($task['file'], '.php');
|
// The task file does not exist
|
// The task file does not exist
|
if(!file_exists(MYBB_ROOT."inc/tasks/{$task['file']}.php")) {
| if(!file_exists(MYBB_ROOT."inc/tasks/{$file}.php")) {
|
if($task['logging'] == 1) { add_task_log($task, $lang->missing_task); }
|
if($task['logging'] == 1) { add_task_log($task, $lang->missing_task); }
|
| // If task file does not exist, disable task and inform the administrator $updated_task = array( "enabled" => 0, "locked" => 0 ); $db->update_query("tasks", $updated_task, "tid='{$task['tid']}'");
$subject = $lang->sprintf($lang->email_broken_task_subject, $mybb->settings['bbname']); $message = $lang->sprintf($lang->email_broken_task, $mybb->settings['bbname'], $mybb->settings['bburl'], $task['title']);
my_mail($mybb->settings['adminemail'], $subject, $message, $mybb->settings['adminemail']);
|
$cache->update_tasks(); return false; }
| $cache->update_tasks(); return false; }
|
Zeile 67 | Zeile 82 |
---|
// Update the nextrun time now, so if the task causes a fatal error, it doesn't get stuck first in the queue $nextrun = fetch_next_run($task); $db->update_query("tasks", array("nextrun" => $nextrun), "tid='{$task['tid']}'");
|
// Update the nextrun time now, so if the task causes a fatal error, it doesn't get stuck first in the queue $nextrun = fetch_next_run($task); $db->update_query("tasks", array("nextrun" => $nextrun), "tid='{$task['tid']}'");
|
include_once MYBB_ROOT."inc/tasks/{$task['file']}.php";
| include_once MYBB_ROOT."inc/tasks/{$file}.php";
|
$function = "task_{$task['file']}"; if(function_exists($function)) {
| $function = "task_{$task['file']}"; if(function_exists($function)) {
|
Zeile 90 | Zeile 105 |
---|
/** * Adds information to the scheduled task log. *
|
/** * Adds information to the scheduled task log. *
|
* @param int The task array to create the log entry for * @param string The message to log
| * @param int $task The task array to create the log entry for * @param string $message The message to log
|
*/ function add_task_log($task, $message) {
| */ function add_task_log($task, $message) {
|
Zeile 113 | Zeile 128 |
---|
/** * Generate the next run time for a particular task. *
|
/** * Generate the next run time for a particular task. *
|
* @param array The task array as fetched from the database.
| * @param array $task The task array as fetched from the database.
|
* @return int The next run time as a UNIX timestamp */ function fetch_next_run($task)
| * @return int The next run time as a UNIX timestamp */ function fetch_next_run($task)
|
Zeile 320 | Zeile 335 |
---|
/** * Builds the next run time bit for a particular item (day, hour, month etc). Used by fetch_next_run(). *
|
/** * Builds the next run time bit for a particular item (day, hour, month etc). Used by fetch_next_run(). *
|
* @param string A string containing the run timse for this particular item * @param int The current value (be it current day etc) * @return int The new or found value
| * @param string $data A string containing the run times for this particular item * @param int $bit The current value (be it current day etc) * @return int|bool The new or found value or boolean if nothing is found
|
*/ function build_next_run_bit($data, $bit) {
| */ function build_next_run_bit($data, $bit) {
|
Zeile 341 | Zeile 356 |
---|
/** * Fetches the fist run bit for a particular item (day, hour, month etc). Used by fetch_next_run(). *
|
/** * Fetches the fist run bit for a particular item (day, hour, month etc). Used by fetch_next_run(). *
|
* @param string A string containing the run times for this particular item
| * @param string $data A string containing the run times for this particular item
|
* @return int The first run time */ function fetch_first_run_time($data)
| * @return int The first run time */ function fetch_first_run_time($data)
|
Zeile 354 | Zeile 369 |
---|
/** * Checks if a specific run time exists for a particular item (day, hour, month etc). Used by fetch_next_run(). *
|
/** * Checks if a specific run time exists for a particular item (day, hour, month etc). Used by fetch_next_run(). *
|
* @param string A string containing the run times for this particular item * @param int The bit we're checking for
| * @param string $data A string containing the run times for this particular item * @param int $bit The bit we're checking for
|
* @return boolean True if it exists, false if it does not */ function run_time_exists($data, $bit)
| * @return boolean True if it exists, false if it does not */ function run_time_exists($data, $bit)
|