Esempio n. 1
0
            $sql = 'INSERT INTO T_cron__task( ctsk_start_datetime, ctsk_repeat_after, ctsk_name, ctsk_controller, ctsk_params )
							VALUES( ' . $DB->quote(date2mysql($new_start_datetime)) . ', ' . $DB->quote($task->ctsk_repeat_after) . ', ' . $DB->quote($ctsk_name) . ', ' . $DB->quote($task->ctsk_controller) . ', ' . $DB->quote($task->ctsk_params) . ' )';
            $DB->query($sql, 'Schedule repeated task.');
        }
        $DB->show_errors = true;
        $DB->halt_on_error = true;
        cron_log('Starting task #' . $ctsk_ID . ' [' . $ctsk_name . '] at ' . date('H:i:s', $localtimenow) . '.', 1);
        if (empty($task->ctsk_params)) {
            $cron_params = array();
        } else {
            $cron_params = unserialize($task->ctsk_params);
        }
        // The job may need to know its ID and name (to set logical locks for example):
        $cron_params['ctsk_ID'] = $ctsk_ID;
        // EXECUTE
        $error_message = call_job($task->ctsk_controller, $cron_params);
        if (!empty($error_message)) {
            $error_task = array('ID' => $ctsk_ID, 'name' => $ctsk_name, 'message' => $error_message);
        }
        // Record task as finished:
        if (empty($timestop)) {
            $timestop = time() + $time_difference;
        }
        if (is_array($result_message)) {
            // If result is array we should store it as serialized data
            $result_message = serialize($result_message);
        }
        $sql = ' UPDATE T_cron__log
								SET clog_status = ' . $DB->quote($result_status) . ',
										clog_realstop_datetime = ' . $DB->quote(date2mysql($timestop)) . ',
										clog_messages = ' . $DB->quote($result_message) . '
Esempio n. 2
0
            $sql = 'INSERT INTO T_cron__task( ctsk_start_datetime, ctsk_repeat_after, ctsk_name, ctsk_controller, ctsk_params )
							VALUES( ' . $DB->quote(date2mysql($new_start_datetime)) . ', ' . $DB->quote($task->ctsk_repeat_after) . ', ' . $DB->quote($ctsk_name) . ', ' . $DB->quote($task->ctsk_controller) . ', ' . $DB->quote($task->ctsk_params) . ' )';
            $DB->query($sql, 'Schedule repeated task.');
        }
        $DB->show_errors = true;
        $DB->halt_on_error = true;
        cron_log('Starting task #' . $ctsk_ID . ' [' . $ctsk_name . '] at ' . date('H:i:s', $localtimenow) . '.');
        if (empty($task->ctsk_params)) {
            $cron_params = array();
        } else {
            $cron_params = unserialize($task->ctsk_params);
        }
        // The job may need to know its ID (to set logical locks for example):
        $cron_params['ctsk_ID'] = $ctsk_ID;
        // EXECUTE
        call_job($task->ctsk_controller, $cron_params);
        // Record task as finished:
        if (empty($timestop)) {
            $timestop = time() + $time_difference;
        }
        $sql = ' UPDATE T_cron__log
								SET clog_status = ' . $DB->quote($result_status) . ',
										clog_realstop_datetime = ' . $DB->quote(date2mysql($timestop)) . ',
										clog_messages = ' . $DB->quote($result_message) . '
							WHERE clog_ctsk_ID = ' . $ctsk_ID;
        $DB->query($sql, 'Record task as finished.');
    }
}
//echo 'detecting timeouts...';
// Detect timed out tasks:
$sql = ' UPDATE T_cron__log
Esempio n. 3
0
            $sql = 'INSERT INTO T_cron__task( ctsk_start_datetime, ctsk_repeat_after, ctsk_name, ctsk_key, ctsk_params )
							VALUES( ' . $DB->quote(date2mysql($new_start_datetime)) . ', ' . $DB->quote($task->ctsk_repeat_after) . ', ' . $ctsk_name_insert . ', ' . $DB->quote($task->ctsk_key) . ', ' . $DB->quote($task->ctsk_params) . ' )';
            $DB->query($sql, 'Schedule repeated task.');
        }
        $DB->show_errors = true;
        $DB->halt_on_error = true;
        cron_log('Starting task #' . $ctsk_ID . ' [' . $ctsk_name . '] at ' . date('H:i:s', $localtimenow) . '.', 1);
        if (empty($task->ctsk_params)) {
            $cron_params = array();
        } else {
            $cron_params = unserialize($task->ctsk_params);
        }
        // The job may need to know its ID and name (to set logical locks for example):
        $cron_params['ctsk_ID'] = $ctsk_ID;
        // EXECUTE
        $error_message = call_job($task->ctsk_key, $cron_params);
        if (!empty($error_message)) {
            $error_task = array('ID' => $ctsk_ID, 'name' => $ctsk_name, 'message' => $error_message);
        }
        // Record task as finished:
        if (empty($timestop)) {
            $timestop = time() + $time_difference;
        }
        if (is_array($result_message)) {
            // If result is array we should store it as serialized data
            $result_message = serialize($result_message);
        }
        $sql = ' UPDATE T_cron__log
								SET clog_status = ' . $DB->quote($result_status) . ',
										clog_realstop_datetime = ' . $DB->quote(date2mysql($timestop)) . ',
										clog_messages = ' . $DB->quote($result_message) . '