From 44716ff439215014a551aca1824504e9ac9b870a Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Mon, 25 Jan 2010 15:39:47 +0000 Subject: [PATCH] almost completed functions to include cronfiles by given/saved time-intervals --- lib/functions/froxlor/function.getNextCronjobs.php | 8 ++++++++ lib/functions/froxlor/function.includeCronjobs.php | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/functions/froxlor/function.getNextCronjobs.php b/lib/functions/froxlor/function.getNextCronjobs.php index d83cc3fa..e8a8cab7 100644 --- a/lib/functions/froxlor/function.getNextCronjobs.php +++ b/lib/functions/froxlor/function.getNextCronjobs.php @@ -46,4 +46,12 @@ function getNextCronjobs() $sql.= ');'; $result = $db->query($query); + + $cron_files = array(); + while($row = $db->fetch_array($result)) + { + $cron_files[] = $row['cronfile']; + } + + return $cron_files; } diff --git a/lib/functions/froxlor/function.includeCronjobs.php b/lib/functions/froxlor/function.includeCronjobs.php index d68692d9..ef404654 100644 --- a/lib/functions/froxlor/function.includeCronjobs.php +++ b/lib/functions/froxlor/function.includeCronjobs.php @@ -19,9 +19,19 @@ function includeCronjobs($debugHandler) { $cronjobs = getNextCronjobs(); - if($cronjobs !== false) + if($cronjobs !== false + && is_array($cronjobs) + && isset($cronjobs[0])) { - // [...] + /* + * @TODO find a better way for the path + */ $cron_path = dirname(__FILE__).'/../../../scripts/jobs/'; + + foreach($cronjobs as $cronjob) + { + $cron_file = makeCorrectFile($cron_path.$cronjob); + include_once($cron_file); + } } }