added the feedback from #ag_entwickler

main
hecht 13 years ago
parent 0a236f6541
commit 81143cf254

@ -10,17 +10,17 @@ include_once(ROOT_PATH.'/include/semaphore.inc.php');
include_once(ROOT_PATH . '/include/sqlwrapper.inc.php'); include_once(ROOT_PATH . '/include/sqlwrapper.inc.php');
define(TASKING_NO_RESCEDULE, 0); define(TASKING_NO_RESCEDULE, 0);
define(TASKING_5_MIN, 0); define(TASKING_5_MIN, 1);
define(TASKING_10_MIN, 0); define(TASKING_10_MIN, 2);
define(TASKING_15_MIN, 0); define(TASKING_15_MIN, 3);
define(TASKING_30_MIN, 0); define(TASKING_30_MIN, 4);
define(TASKING_1_HOUR, 0); define(TASKING_1_HOUR, 5);
define(TASKING_2_HOUR, 0); define(TASKING_2_HOUR, 6);
define(TASKING_6_HOUR, 0); define(TASKING_6_HOUR, 7);
define(TASKING_12_HOUR, 0); define(TASKING_12_HOUR, 8);
define(TASKING_DAYLY, 0); define(TASKING_DAYLY, 9);
define(TASKING_DAY_OF_WEEK, 0); define(TASKING_DAY_OF_WEEK, 10);
define(TASKING_DAY_OF_MONTH, 0); define(TASKING_DAY_OF_MONTH, 11);
/** /**
* The method that has to be called by a cronjob! * The method that has to be called by a cronjob!
@ -51,10 +51,11 @@ function tick() {
* @param int $task_id the task id that should be updated (if one only wants to update an existant job) * @param int $task_id the task id that should be updated (if one only wants to update an existant job)
*/ */
function schedule($script_name, array $parameters, $execution_time, $repeat_mode, $catchUpOn = false, $task_id = NULL) { function schedule($script_name, array $parameters, $execution_time, $repeat_mode, $catchUpOn = false, $task_id = NULL) {
// FIXME: Solve the parameter problem differently ;)
if($task_id === NULL) { if($task_id === NULL) {
db_query('INSERT INTO tasking(script_name, parameter, schedule_time, mode, catchup) values(\''.$script_name.'\', \''.implode(',', parameters).'\', \''.$execution_time.'\', \''.$repeat_mode.'\', \''.$catchUpOn.'\')'); db_query('INSERT INTO tasking(script_name, parameter, schedule_time, mode, catchup) values(\''.$script_name.'\', \''.implode(',', $parameters).'\', \''.$execution_time.'\', \''.$repeat_mode.'\', \''.$catchUpOn.'\')');
} else { } else {
db_query('UPDATE tasking SET script_name = \''.$script_name.'\' , parameter = \''.implode(',', parameters).'\', schedule_time = \''.$execution_time.'\', mode = \''.$repeat_mode.'\', catchup = \''.$catchUpOn.'\' WHERE task_id = ' . $task_id); db_query('UPDATE tasking SET script_name = \''.$script_name.'\' , parameter = \''.implode(',', $parameters).'\', schedule_time = \''.$execution_time.'\', mode = \''.$repeat_mode.'\', catchup = \''.$catchUpOn.'\' WHERE task_id = ' . $task_id);
} }
} }
@ -117,8 +118,9 @@ function executeScript($task_id) {
return; return;
} }
$time = $task['schedule_time']; // TODO: execute the script
$time = $task['schedule_time'];
switch($task['mode']) switch($task['mode'])
{ {
case TASKING_NO_RESCEDULE: case TASKING_NO_RESCEDULE:

Loading…
Cancel
Save