Ajout date de debut
This commit is contained in:
parent
6f80c5e980
commit
db7b05cd0c
@ -23,42 +23,46 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
print strftime("%H:%M:%S",time())."\n";
|
||||||
require ("../../master.inc.php");
|
require ("../../master.inc.php");
|
||||||
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/ProcessGraphLignes.class.php");
|
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/ProcessGraphLignes.class.php");
|
||||||
|
|
||||||
$childrenTotal = 4;
|
$datetime = time();
|
||||||
$childrenNow = 0;
|
$month = strftime("%m", $datetime);
|
||||||
$clientPerChild = 0;
|
$year = strftime("%Y", $datetime);
|
||||||
|
|
||||||
$sql = "SELECT max(rowid)";
|
if ($month == 1)
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne";
|
|
||||||
|
|
||||||
if ($db->query($sql))
|
|
||||||
{
|
{
|
||||||
$row = $db->fetch_row();
|
$month = "12";
|
||||||
$clientPerChild = ceil($row[0] / $childrenTotal);
|
$year = $year - 1;
|
||||||
$db->free();
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$month = substr("00".($month - 1), -2) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( $childrenNow < $childrenTotal )
|
$sql = "SELECT distinct(fk_ligne)";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
|
||||||
|
$sql .= " WHERE date_format(date,'%m%Y') = '".$month.$year."'";
|
||||||
|
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
|
||||||
|
if ($resql)
|
||||||
{
|
{
|
||||||
$pid = pcntl_fork();
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
if ( $pid == -1 )
|
print "$num lignes\n";
|
||||||
{
|
|
||||||
die( "error\n" );
|
|
||||||
}
|
|
||||||
elseif ( $pid == 0 )
|
|
||||||
{
|
|
||||||
$childrenNow++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$process = new ProcessGraphLignes( $childrenNow, $clientPerChild );
|
|
||||||
$process->go();
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
usleep(100000);
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
print substr("0000".($i+1), -4) . "/".substr("0000".$num, -4)."\n";
|
||||||
|
$row = $db->fetch_row($resql);
|
||||||
|
|
||||||
|
$gr = new ProcessGraphLignes($db);
|
||||||
|
$gr->go($row[0]);
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user