From 8e19dde88e76556417fc9549a572713dd2d182dc Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Wed, 1 Feb 2012 16:30:22 +0000 Subject: [PATCH] Protection objet --- batch/cron.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/batch/cron.php b/batch/cron.php index 3eac3648..6a68cfd9 100644 --- a/batch/cron.php +++ b/batch/cron.php @@ -53,15 +53,18 @@ $sql = $commandesM->select() ->where("dateStart != '0000-00-00 00:00:00'") ->where("dateStop = '0000-00-00 00:00:00'"); $result = $commandesM->fetchAll($sql); -if (count($result)>0){ +if (count($result->toArray())>0){ exit; } //Si pas de traitement en cours alors on lance $sql = $commandesM->select() ->where('idProfil != ?', 0) + ->where("dateStart = '0000-00-00 00:00:00'") ->where("dateStop = '0000-00-00 00:00:00'"); $result = $commandesM->fetchAll($sql, 'dateAdded ASC', 1); -$info = $result->current(); -echo "Lancement enrichissement $info->id\n"; -exec(realpath(dirname(__FILE__))."/enrichissement.php --id ".$info->id." &"); +if (count($result->toArray())>0){ + $info = $result->current(); + echo "Lancement enrichissement $info->id\n"; + exec(realpath(dirname(__FILE__))."/enrichissement.php --id ".$info->id." &"); +} \ No newline at end of file