From 81143cf254391b2cd1b1f4789f6207e9afb50c64 Mon Sep 17 00:00:00 2001 From: hecht Date: Tue, 31 Jan 2012 21:57:30 +0000 Subject: [PATCH] added the feedback from #ag_entwickler --- ag/include/tasking.inc.php | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/ag/include/tasking.inc.php b/ag/include/tasking.inc.php index bbcc2c8..a3e32b7 100644 --- a/ag/include/tasking.inc.php +++ b/ag/include/tasking.inc.php @@ -10,17 +10,17 @@ include_once(ROOT_PATH.'/include/semaphore.inc.php'); include_once(ROOT_PATH . '/include/sqlwrapper.inc.php'); define(TASKING_NO_RESCEDULE, 0); -define(TASKING_5_MIN, 0); -define(TASKING_10_MIN, 0); -define(TASKING_15_MIN, 0); -define(TASKING_30_MIN, 0); -define(TASKING_1_HOUR, 0); -define(TASKING_2_HOUR, 0); -define(TASKING_6_HOUR, 0); -define(TASKING_12_HOUR, 0); -define(TASKING_DAYLY, 0); -define(TASKING_DAY_OF_WEEK, 0); -define(TASKING_DAY_OF_MONTH, 0); +define(TASKING_5_MIN, 1); +define(TASKING_10_MIN, 2); +define(TASKING_15_MIN, 3); +define(TASKING_30_MIN, 4); +define(TASKING_1_HOUR, 5); +define(TASKING_2_HOUR, 6); +define(TASKING_6_HOUR, 7); +define(TASKING_12_HOUR, 8); +define(TASKING_DAYLY, 9); +define(TASKING_DAY_OF_WEEK, 10); +define(TASKING_DAY_OF_MONTH, 11); /** * 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) */ 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) { - 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 { - 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; } - $time = $task['schedule_time']; + // TODO: execute the script + $time = $task['schedule_time']; switch($task['mode']) { case TASKING_NO_RESCEDULE: