<?php $LOG = "##########################################\r\n"; $LOG .= date('Y-m-d H:i:s')."\r\n"; $timestart=microtime(true); require_once("../../inc/confNetisse.php"); ini_set('memory_limit','-1'); ini_set('max_execution_time', 0); // NOMBRE TOTAL DE CONSEILLERS DANS ca_conseiller_agence $q = "SELECT count(id_conseiller) as nb FROM `ca_conseiller_agence`"; $r = excuteQuery($q); $NBCACONSEILLERS = $r['stmt']->fetch( PDO::FETCH_ASSOC )['nb']; echo "<li>NB CONSEILLERS DANS ca_conseiller_agence = ".$NBCACONSEILLERS; // NOMBRE TOTAL DE CLIENTS DANS ca_client_motifs $q = "SELECT count(id_conseiller) as nb FROM `ca_conseiller_agence` WHERE temporaire = 1"; $r = excuteQuery($q); $NBCACONSEILLERSTEMP = $r['stmt']->fetch( PDO::FETCH_ASSOC )['nb']; echo "<li>NB CONSEILLERS TEMPORAIRES DANS ca_conseiller_agence = ".$NBCACONSEILLERSTEMP; if ($NBCACONSEILLERSTEMP > 0) { $NBTOTALPREVU = $NBCACONSEILLERS - $NBCACONSEILLERSTEMP; echo "<li>DELETE de ca_conseiller_agence"; $q = "DELETE FROM ca_conseiller_agence WHERE temporaire = 1"; $r = excuteQuery($q); $LOG .= "=> DELETE\r\n"; $q = "SELECT count(id_conseiller) as nb FROM `ca_conseiller_agence`"; $r = excuteQuery($q); $NBCACONSEILLERSAPRES = $r['stmt']->fetch( PDO::FETCH_ASSOC )['nb']; echo "<li>NB CONSEILLERS DANS ca_conseiller_agence <span style='color:#ff0000;font-weight:bold;'>APRES</span> = ".$NBCACONSEILLERSAPRES; $LOG .= "NB CONSEILLERS DANS ca_conseiller_agence APRES = ".$NBCACONSEILLERSAPRES."\r\n"; echo "<br/><br/><li>NBCACONSEILLERSAVANT (".$NBCACONSEILLERS.") = NBCACONSEILLERSAPRES (".$NBCACONSEILLERSAPRES.")"; $LOG .= "NBCACONSEILLERSAVANT (".$NBCACONSEILLERS.") = NBCACONSEILLERSAPRES (".$NBCACONSEILLERSAPRES.")\r\n"; if ($NBCACONSEILLERSAPRES == $NBTOTALPREVU) { echo "<li>OK => DELETE EFFECTUEE"; $LOG .= "=> DELETE EFFECTUEE\r\n"; } else { echo "<li>PROBLEME DE CORRESPONDANCE : NBCACONSEILLERSAPRES != TOTAL PREVU"; $LOG .= "===> PROBLEME DE CORRESPONDANCE : NBCACONSEILLERSAPRES != TOTAL PREVU\r\n"; } } else { $LOG .= "=> Aucun conseiller temporaire...\r\n"; } $timeend=microtime(true); $time=$timeend-$timestart; $page_load_time = number_format($time, 3); $scriptStart = date("H:i:s", $timestart); $scriptEnd = date("H:i:s", $timeend); $timeLoad = $page_load_time; $LOG .= "DUREE = ".$timeLoad." s\r\n"; echo "<li>Debut du script: ".date("H:i:s", $timestart); echo "<br>Fin du script: ".date("H:i:s", $timeend); echo "<br>Script execute en " . $page_load_time . " sec"; $fp = fopen ("logs/cron_temps.txt", "a+"); fwrite($fp, $LOG); fclose ($fp); ?>