|
|
|
@ -42,12 +42,6 @@ class InitDataCommand extends ContainerAwareCommand
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function insertCron() {
|
|
|
|
|
|
|
|
|
|
// afin de forcer les ID sur certaines entités
|
|
|
|
|
$metadata = $this->entityManager->getClassMetaData(get_class($entity));
|
|
|
|
|
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
|
|
|
|
|
$metadata->setIdGenerator(new AssignedGenerator());
|
|
|
|
|
|
|
|
|
|
// Job Mail
|
|
|
|
|
// Toute les minutes
|
|
|
|
|
$entity = $this->entityManager->getRepository('CadolesCronBundle:Cron')->find(1);
|
|
|
|
@ -64,7 +58,124 @@ class InitDataCommand extends ContainerAwareCommand
|
|
|
|
|
$entity->setJsonargument('{"message-limit":"100","env":"prod"}');
|
|
|
|
|
$this->entityManager->persist($entity);
|
|
|
|
|
}
|
|
|
|
|
// afin de forcer les ID sur certaines entités
|
|
|
|
|
$metadata = $this->entityManager->getClassMetaData(get_class($entity));
|
|
|
|
|
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
|
|
|
|
|
$metadata->setIdGenerator(new AssignedGenerator());
|
|
|
|
|
|
|
|
|
|
// Job synchronisation des comptes utilisateur
|
|
|
|
|
// Toute les 24h à 3h00
|
|
|
|
|
$entity = $this->entityManager->getRepository('CadolesCronBundle:Cron')->find(100);
|
|
|
|
|
if(!$entity) {
|
|
|
|
|
$entity = new Cron;
|
|
|
|
|
$nextdate=$entity->getSubmitdate();
|
|
|
|
|
$nextdate->setTime(3,0);
|
|
|
|
|
$entity->setCommand("Core:Synchro");
|
|
|
|
|
$entity->setDescription("Synchronisation des Comptes Utilisateurs");
|
|
|
|
|
$entity->setId(100);
|
|
|
|
|
$entity->setStatut(2);
|
|
|
|
|
$entity->setRepeatcall(0);
|
|
|
|
|
$entity->setRepeatexec(0);
|
|
|
|
|
$entity->setRepeatinterval(86400);
|
|
|
|
|
$entity->setNextexecdate($nextdate);
|
|
|
|
|
$entity->setJsonargument('{"simulate":"false"}');
|
|
|
|
|
$this->entityManager->persist($entity);
|
|
|
|
|
}
|
|
|
|
|
// Job purge des registrations obsolètes
|
|
|
|
|
// Toute les 5mn
|
|
|
|
|
$entity = $this->entityManager->getRepository('CadolesCronBundle:Cron')->find(110);
|
|
|
|
|
if(!$entity) {
|
|
|
|
|
$entity = new Cron;
|
|
|
|
|
$entity->setCommand("Core:PurgeRegistration");
|
|
|
|
|
$entity->setDescription("Purge des Inscriptions obsolètes");
|
|
|
|
|
$entity->setId(110);
|
|
|
|
|
$entity->setStatut(2);
|
|
|
|
|
$entity->setRepeatcall(0);
|
|
|
|
|
$entity->setRepeatexec(0);
|
|
|
|
|
$entity->setRepeatinterval(300);
|
|
|
|
|
$entity->setNextexecdate($entity->getSubmitdate());
|
|
|
|
|
$this->entityManager->persist($entity);
|
|
|
|
|
}
|
|
|
|
|
// Job de purge des fichiers obsolète
|
|
|
|
|
// Toute les 24h à 3h00
|
|
|
|
|
$entity = $this->entityManager->getRepository('CadolesCronBundle:Cron')->find(200);
|
|
|
|
|
if(!$entity) {
|
|
|
|
|
$entity = new Cron;
|
|
|
|
|
$nextdate=$entity->getSubmitdate();
|
|
|
|
|
$nextdate->setTime(3,0);
|
|
|
|
|
$entity->setCommand("Core:PurgeFile");
|
|
|
|
|
$entity->setDescription("Suppression des fichiers obsolètes");
|
|
|
|
|
$entity->setId(200);
|
|
|
|
|
$entity->setStatut(2);
|
|
|
|
|
$entity->setRepeatcall(0);
|
|
|
|
|
$entity->setRepeatexec(0);
|
|
|
|
|
$entity->setRepeatinterval(86400);
|
|
|
|
|
$entity->setNextexecdate($nextdate);
|
|
|
|
|
$this->entityManager->persist($entity);
|
|
|
|
|
}
|
|
|
|
|
// CRON PORTAIL
|
|
|
|
|
// Job purge des registrations obsolètes
|
|
|
|
|
// Toute les 5mn
|
|
|
|
|
$portal_activate = $this->getContainer()->getParameter('portal_activate');
|
|
|
|
|
$calendar_activate = $this->getContainer()->getParameter('calendar_activate');
|
|
|
|
|
$entity = $this->entityManager->getRepository('CadolesCronBundle:Cron')->find(1000);
|
|
|
|
|
if(!$entity&&($portal_activate||$calendar_activate)) {
|
|
|
|
|
$entity = new Cron;
|
|
|
|
|
$entity->setCommand("Portal:SynchroICS");
|
|
|
|
|
$entity->setDescription("Synchronisation des Calendriers Utilisateurs liés à une URL ICS");
|
|
|
|
|
$entity->setId(1000);
|
|
|
|
|
$entity->setStatut(2);
|
|
|
|
|
$entity->setRepeatcall(0);
|
|
|
|
|
$entity->setRepeatexec(0);
|
|
|
|
|
$entity->setRepeatinterval(600);
|
|
|
|
|
$entity->setNextexecdate($entity->getSubmitdate());
|
|
|
|
|
$this->entityManager->persist($entity);
|
|
|
|
|
}
|
|
|
|
|
elseif($entity&&!($portal_activate||$calendar_activate)) {
|
|
|
|
|
$this->entityManager->remove($entity);
|
|
|
|
|
}
|
|
|
|
|
// Job de récupération des sondages Limesurvey
|
|
|
|
|
// Toute les 6h
|
|
|
|
|
$activate_widlimesurvey = $this->getContainer()->getParameter('activate_widlimesurvey');
|
|
|
|
|
$entity = $this->entityManager->getRepository('CadolesCronBundle:Cron')->find(1010);
|
|
|
|
|
if(!$entity&&$activate_widlimesurvey) {
|
|
|
|
|
$entity = new Cron;
|
|
|
|
|
$nextdate=$entity->getSubmitdate();
|
|
|
|
|
$nextdate->setTime(1,0);
|
|
|
|
|
$entity->setCommand("Portal:GetLimesurvey");
|
|
|
|
|
$entity->setDescription("Récupération des sondages Limesurvey");
|
|
|
|
|
$entity->setId(1010);
|
|
|
|
|
$entity->setStatut(2);
|
|
|
|
|
$entity->setRepeatcall(0);
|
|
|
|
|
$entity->setRepeatexec(0);
|
|
|
|
|
$entity->setRepeatinterval(21600);
|
|
|
|
|
$entity->setNextexecdate($nextdate);
|
|
|
|
|
$this->entityManager->persist($entity);
|
|
|
|
|
}
|
|
|
|
|
elseif($entity&&!$activate_widlimesurvey) {
|
|
|
|
|
$this->entityManager->remove($entity);
|
|
|
|
|
}
|
|
|
|
|
// Job de récupération des cours Moodle
|
|
|
|
|
// Toute les 6h
|
|
|
|
|
$activate_widmoodle = $this->getContainer()->getParameter('activate_widmoodle');
|
|
|
|
|
$entity = $this->entityManager->getRepository('CadolesCronBundle:Cron')->find(1020);
|
|
|
|
|
if(!$entity&&$activate_widmoodle) {
|
|
|
|
|
$entity = new Cron;
|
|
|
|
|
$nextdate=$entity->getSubmitdate();
|
|
|
|
|
$nextdate->setTime(1,0);
|
|
|
|
|
$entity->setCommand("Portal:GetMoodle");
|
|
|
|
|
$entity->setDescription("Récupération des cours Moodle ");
|
|
|
|
|
$entity->setId(1020);
|
|
|
|
|
$entity->setStatut(2);
|
|
|
|
|
$entity->setRepeatcall(0);
|
|
|
|
|
$entity->setRepeatexec(0);
|
|
|
|
|
$entity->setRepeatinterval(21600);
|
|
|
|
|
$entity->setNextexecdate($nextdate);
|
|
|
|
|
$this->entityManager->persist($entity);
|
|
|
|
|
}
|
|
|
|
|
elseif($entity&&!$activate_widmoodle) {
|
|
|
|
|
$this->entityManager->remove($entity);
|
|
|
|
|
}
|
|
|
|
|
$this->entityManager->flush();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|