53 lines
1.4 KiB
PHP
Executable File
53 lines
1.4 KiB
PHP
Executable File
<?php
|
|
require_once 'Societeusercentral.php';
|
|
require_once 'Cronenvoimail.php';
|
|
|
|
class Cronchaqueminuteproduction
|
|
{
|
|
private $cronenvoimail;
|
|
|
|
public function __construct() {
|
|
|
|
}
|
|
|
|
public function executer()
|
|
{
|
|
$this->societeusercentral = new Societeusercentral();
|
|
$this->cronenvoimail = new Cronenvoimail();
|
|
|
|
$liste_societeuser = $this->societeusercentral->getSocieteusers();
|
|
|
|
$_SESSION['old_codeSociete']="";
|
|
|
|
foreach ($liste_societeuser as $societeuser)
|
|
{
|
|
$codeSociete = $societeuser['codeSociete'];
|
|
$_SESSION['c_codeSociete'] = $codeSociete;
|
|
|
|
// Début Cronenvoimail
|
|
$this->cronenvoimail->chargersociete();
|
|
$nbMail = $this->cronenvoimail->nbMailParCron;
|
|
$this->cronenvoimail->$nbMail = $nbMail;
|
|
$this->cronenvoimail->charger_les_mails($nbMail);
|
|
$this->cronenvoimail->envoyer_les_mails();
|
|
// Fin Cronenvoimail
|
|
}
|
|
}
|
|
}
|
|
// Execution
|
|
$cronchaqueminuteproduction = new Cronchaqueminuteproduction();
|
|
// $cronchaqueminuteproduction->executer();
|
|
|
|
$iterations = 25; // On va boucler 25 fois
|
|
// $interval = 5; // secondes
|
|
$interval = 2000; // millisecondes
|
|
|
|
for ($i = 0; $i < $iterations; $i++)
|
|
{
|
|
$cronchaqueminuteproduction->executer();
|
|
if ($i < $iterations - 1) {
|
|
// sleep($interval); // secondes
|
|
usleep($interval); // Stoppe en millisecondes
|
|
}
|
|
}
|