#!/usr/bin/php "Aide.", ) ); $opts->parse(); } catch (Zend_Console_Getopt_Exception $e) { echo $e->getUsageMessage(); exit; } //Usage if(isset($opts->help)) { echo $opts->getUsageMessage(); exit; } $c = new Zend_Config($application->getOptions()); $db = Zend_Db::factory($c->profil->db->local); $commandesM = new Application_Model_Commandes($db); $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); if ( count($result)==0 ) { //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'") ->order('dateAdded ASC')->limit(1); $result = $commandesM->fetchAll($sql); if (count($result)>0) { $info = $result->current(); echo date('Y-m-d H:i:s')." - Lancement enrichissement $info->id\n"; $c = new Zend_Config($application->getOptions()); $log = $c->profil->path->data.'/log/'.$info->id.'.log'; exec('php '.__DIR__."/jobs/enrichissement.php --id ".$info->id." 2>&1 >> ".$log." &"); } }