Loading documentation/release/3.2.3.md +1 −1 Changes for documentation/release/3.2.3.md: 1 added line, 1 removed line. Original line number Diff line number Diff line Version 3.2.3 (XX/XX/2023) Version 3.2.3 (26/05/2023) ==== Évolution Loading documentation/release/3.2.4.md 0 → 100644 +29 −0 Changes for documentation/release/3.2.4.md: 29 added lines, 0 removed lines. Original line number Diff line number Diff line Version 3.2.4 (XX/XX/2023) ==== Évolution --- - Modification de Unicaen/Aide - Modification de SynchroOctopus pour utiliser le nouveau système de synchronisation Modification en BD --- ```postgresql ``` Evolution des librairies --- Mise à jour de unicaen/aide (0.3.0) ```bash composer upgrade unicaen/aide ``` ou réinstalle des libraires ```bash rm -fr vendor rm -fr composer.lock composer install ``` module/Application/src/Application/Service/Evenement/SynchroOctopusService.php +9 −8 Changes for module/Application/src/Application/Service/Evenement/SynchroOctopusService.php: 9 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -5,12 +5,13 @@ namespace Application\Service\Evenement; use Application\Provider\EvenementProvider; use DateTime; use Exception; use Referentiel\Service\Synchronisation\SynchronisationServiceAwareTrait; use UnicaenEvenement\Entity\Db\Etat; use UnicaenEvenement\Entity\Db\Evenement; use UnicaenEvenement\Service\Evenement\EvenementService; class SynchroOctopusService extends EvenementService { // use SynchroServiceAwareTrait; use SynchronisationServiceAwareTrait; /** * @param DateTime|null $dateTraitement Loading @@ -31,14 +32,14 @@ class SynchroOctopusService extends EvenementService { */ public function traiter(Evenement $evenement) : string { try { $log = ""; // $synchros = $this->getSynchroService()->getSynchros(); // foreach ($synchros as $synchro) { // $log .= "### " . $synchro->getName() . " ###<br/>\n"; // $log .= $this->getSynchroService()->runSynchro($synchro); // $log .= "<br/>\n"; // } try { $jobs = $this->getSynchronisationService()->configs; foreach ($jobs as $name => $job) { $texte = $this->getSynchronisationService()->synchronise($name); $log .= $texte; echo $texte; } } catch(Exception $e) { $evenement->setLog($e->getMessage()); return Etat::ECHEC; Loading module/Application/src/Application/Service/Evenement/SynchroOctopusServiceFactory.php +7 −2 Changes for module/Application/src/Application/Service/Evenement/SynchroOctopusServiceFactory.php: 7 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,9 @@ namespace Application\Service\Evenement; use Doctrine\ORM\EntityManager; use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Referentiel\Service\Synchronisation\SynchronisationService; use UnicaenEvenement\Service\Type\TypeService; class SynchroOctopusServiceFactory { Loading @@ -11,6 +14,8 @@ class SynchroOctopusServiceFactory { /** * @param ContainerInterface $container * @return SynchroOctopusService * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container) : SynchroOctopusService { Loading @@ -19,13 +24,13 @@ class SynchroOctopusServiceFactory { * @var TypeService $typeService */ $entityManager = $container->get('doctrine.entitymanager.orm_default'); // $synchroService = $container->get(SynchroService::class); $synchroService = $container->get(SynchronisationService::class); $typeService = $container->get(TypeService::class); $service = new SynchroOctopusService(); $service->setEntityManager($entityManager); // $service->setSynchroService($synchroService); $service->setSynchronisationService($synchroService); $service->setTypeService($typeService); return $service; } Loading module/Referentiel/src/Referentiel/Service/Synchronisation/SynchronisationService.php +33 −25 Changes for module/Referentiel/src/Referentiel/Service/Synchronisation/SynchronisationService.php: 33 added lines, 25 removed lines. Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ class SynchronisationService { $this->entityManagers = $entityManagers; } private array $configs = []; public array $configs = []; public function setConfigs(array $configs): void { $this->configs = $configs; Loading Loading @@ -47,9 +47,14 @@ class SynchronisationService { public function synchronise(string $name) : string { echo "Synchronisation [".$name."]\n"; flush(); $log = ""; $line = "Synchronisation [".$name."]\n"; echo $line; flush(); $log .= "<strong>" . $line ."</strong><br>"; $debut = new DateTime(); echo "Debut: ".$debut->format('d/m/y H:i:s:u')."\n"; flush(); $line = "Debut: ".$debut->format('d/m/y H:i:s:u')."\n"; flush(); echo $line; flush(); $log .= $line ."<br>"; $correspondance = $this->getFromConfig($name, 'correspondance'); $orm_source = $this->entityManagers[$this->getFromConfig($name, 'orm_source')]; Loading @@ -61,75 +66,78 @@ class SynchronisationService { $id_destination = $correspondance[$id_source]; $data_source = $this->getSqlHelperService()->fetch($orm_source, $table_source, $correspondance, 'source', $id_source); echo count($data_source). " entrées dans les données sources.\n"; flush(); $line = count($data_source). " entrées dans les données sources.\n"; echo $line; flush(); $log .= $line ."<br>"; $data_destination = $this->getSqlHelperService()->fetch($orm_destination, $table_destination, $correspondance, 'destination', $id_destination); $data_destination_on = []; $data_destination_off = []; foreach ($data_destination as $item) { if ($item['deleted_on'] !== null) $data_destination_off[] = $item; else $data_destination_on[] = $item; } echo count($data_destination_on) . "(~". count($data_destination_off).")". " entrées dans les données cibles actives.\n"; flush(); $line = count($data_destination_on) . "(~". count($data_destination_off).")". " entrées dans les données cibles actives.\n"; echo $line; flush(); $log .= $line ."<br>"; $read = new DateTime(); echo "Lecture: ".$read->format('d/m/y H:i:s:u'). "(" . ($read->diff($debut))->format('%H:%m:%s:%F').")\n"; flush(); $line = "Lecture: ".$read->format('d/m/y H:i:s:u'). "(" . ($read->diff($debut))->format('%H:%m:%s:%F').")\n"; echo $line; flush(); $log .= $line ."<br>"; //check for removal $nbRetrait = 0; // $texte_retrait = ""; foreach ($data_destination as $id => $item) { if ($item['deleted_on'] === null AND !isset($data_source[$id])) { $nbRetrait++; // $texte_retrait .= "Retrait de ".$id." des données destination.\n"; $this->getSqlHelperService()->delete($orm_destination, $table_destination, $id); } } echo "#Retrait: ".$nbRetrait."\n"; flush(); // $log .= $texte_retrait; $line = "#Retrait: ".$nbRetrait."\n"; echo $line; flush(); $log .= $line ."<br>"; //check for adding $nbAjout = 0; // $texte_ajout = ""; foreach ($data_source as $id => $item) { if (!isset($data_destination[$id])) { $nbAjout++; // $texte_ajout .= "Ajout de ".$id." des données sources.\n"; $this->getSqlHelperService()->insert($orm_destination, $table_destination, $item, $correspondance, $source); } } echo "#Ajout: ".$nbAjout."\n"; flush(); // $log .= $texte_ajout; $line = "#Ajout: ".$nbAjout."\n"; echo $line; flush(); $log .= $line ."<br>"; //check for restauration $nbRestauration = 0; // $texte_restauration = ""; foreach ($data_source as $id => $item) { if (isset($data_destination[$id]) AND $data_destination[$id]["deleted_on"] !== null) { $nbRestauration++; // $texte_restauration .= "Restauration de ".$id." des données destinations.\n"; $this->getSqlHelperService()->restore($orm_destination, $table_destination, $id); } } echo "#Restauration: ".$nbRestauration."\n"; flush(); // $log .= $texte_restauration; $line = "#Restauration: ".$nbRestauration."\n"; echo $line; flush(); $log .= $line ."<br>"; //check for modification $nbModification = 0; // $texte_modication = ""; foreach ($data_source as $id => $item) { if (isset($data_destination[$id]) AND $this->checkDifferences($item, $data_destination[$id], $correspondance, $source)) { $nbModification++; // $texte_modication .= "Modif de ".$id." des données sources.\n"; $this->getSqlHelperService()->update($orm_destination, $table_destination, $item, $correspondance, $id, $source); } } echo "#Modification: ".$nbModification."\n"; flush(); // $log .= $texte_modication; $line .= "#Modification: ".$nbModification."\n"; echo $line; flush(); $log .= $line ."<br>"; $fin = new DateTime(); echo "Fin: ".$fin->format('d/m/y H:i:s:u')."\n"; echo "Durée de la synchronisation: " . ($fin->diff($debut))->format('%H:%m:%s:%F') . "\n"; $line = "Fin: ".$fin->format('d/m/y H:i:s:u')."\n"; echo $line; flush(); $log .= $line ."<br>"; $line = "Durée de la synchronisation: " . ($fin->diff($debut))->format('%H:%m:%s:%F') . "\n"; echo $line; flush(); $log .= $line ."<br>"; return ""; return $log; } } No newline at end of file Loading
documentation/release/3.2.3.md +1 −1 Changes for documentation/release/3.2.3.md: 1 added line, 1 removed line. Original line number Diff line number Diff line Version 3.2.3 (XX/XX/2023) Version 3.2.3 (26/05/2023) ==== Évolution Loading
documentation/release/3.2.4.md 0 → 100644 +29 −0 Changes for documentation/release/3.2.4.md: 29 added lines, 0 removed lines. Original line number Diff line number Diff line Version 3.2.4 (XX/XX/2023) ==== Évolution --- - Modification de Unicaen/Aide - Modification de SynchroOctopus pour utiliser le nouveau système de synchronisation Modification en BD --- ```postgresql ``` Evolution des librairies --- Mise à jour de unicaen/aide (0.3.0) ```bash composer upgrade unicaen/aide ``` ou réinstalle des libraires ```bash rm -fr vendor rm -fr composer.lock composer install ```
module/Application/src/Application/Service/Evenement/SynchroOctopusService.php +9 −8 Changes for module/Application/src/Application/Service/Evenement/SynchroOctopusService.php: 9 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -5,12 +5,13 @@ namespace Application\Service\Evenement; use Application\Provider\EvenementProvider; use DateTime; use Exception; use Referentiel\Service\Synchronisation\SynchronisationServiceAwareTrait; use UnicaenEvenement\Entity\Db\Etat; use UnicaenEvenement\Entity\Db\Evenement; use UnicaenEvenement\Service\Evenement\EvenementService; class SynchroOctopusService extends EvenementService { // use SynchroServiceAwareTrait; use SynchronisationServiceAwareTrait; /** * @param DateTime|null $dateTraitement Loading @@ -31,14 +32,14 @@ class SynchroOctopusService extends EvenementService { */ public function traiter(Evenement $evenement) : string { try { $log = ""; // $synchros = $this->getSynchroService()->getSynchros(); // foreach ($synchros as $synchro) { // $log .= "### " . $synchro->getName() . " ###<br/>\n"; // $log .= $this->getSynchroService()->runSynchro($synchro); // $log .= "<br/>\n"; // } try { $jobs = $this->getSynchronisationService()->configs; foreach ($jobs as $name => $job) { $texte = $this->getSynchronisationService()->synchronise($name); $log .= $texte; echo $texte; } } catch(Exception $e) { $evenement->setLog($e->getMessage()); return Etat::ECHEC; Loading
module/Application/src/Application/Service/Evenement/SynchroOctopusServiceFactory.php +7 −2 Changes for module/Application/src/Application/Service/Evenement/SynchroOctopusServiceFactory.php: 7 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,9 @@ namespace Application\Service\Evenement; use Doctrine\ORM\EntityManager; use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Referentiel\Service\Synchronisation\SynchronisationService; use UnicaenEvenement\Service\Type\TypeService; class SynchroOctopusServiceFactory { Loading @@ -11,6 +14,8 @@ class SynchroOctopusServiceFactory { /** * @param ContainerInterface $container * @return SynchroOctopusService * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container) : SynchroOctopusService { Loading @@ -19,13 +24,13 @@ class SynchroOctopusServiceFactory { * @var TypeService $typeService */ $entityManager = $container->get('doctrine.entitymanager.orm_default'); // $synchroService = $container->get(SynchroService::class); $synchroService = $container->get(SynchronisationService::class); $typeService = $container->get(TypeService::class); $service = new SynchroOctopusService(); $service->setEntityManager($entityManager); // $service->setSynchroService($synchroService); $service->setSynchronisationService($synchroService); $service->setTypeService($typeService); return $service; } Loading
module/Referentiel/src/Referentiel/Service/Synchronisation/SynchronisationService.php +33 −25 Changes for module/Referentiel/src/Referentiel/Service/Synchronisation/SynchronisationService.php: 33 added lines, 25 removed lines. Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ class SynchronisationService { $this->entityManagers = $entityManagers; } private array $configs = []; public array $configs = []; public function setConfigs(array $configs): void { $this->configs = $configs; Loading Loading @@ -47,9 +47,14 @@ class SynchronisationService { public function synchronise(string $name) : string { echo "Synchronisation [".$name."]\n"; flush(); $log = ""; $line = "Synchronisation [".$name."]\n"; echo $line; flush(); $log .= "<strong>" . $line ."</strong><br>"; $debut = new DateTime(); echo "Debut: ".$debut->format('d/m/y H:i:s:u')."\n"; flush(); $line = "Debut: ".$debut->format('d/m/y H:i:s:u')."\n"; flush(); echo $line; flush(); $log .= $line ."<br>"; $correspondance = $this->getFromConfig($name, 'correspondance'); $orm_source = $this->entityManagers[$this->getFromConfig($name, 'orm_source')]; Loading @@ -61,75 +66,78 @@ class SynchronisationService { $id_destination = $correspondance[$id_source]; $data_source = $this->getSqlHelperService()->fetch($orm_source, $table_source, $correspondance, 'source', $id_source); echo count($data_source). " entrées dans les données sources.\n"; flush(); $line = count($data_source). " entrées dans les données sources.\n"; echo $line; flush(); $log .= $line ."<br>"; $data_destination = $this->getSqlHelperService()->fetch($orm_destination, $table_destination, $correspondance, 'destination', $id_destination); $data_destination_on = []; $data_destination_off = []; foreach ($data_destination as $item) { if ($item['deleted_on'] !== null) $data_destination_off[] = $item; else $data_destination_on[] = $item; } echo count($data_destination_on) . "(~". count($data_destination_off).")". " entrées dans les données cibles actives.\n"; flush(); $line = count($data_destination_on) . "(~". count($data_destination_off).")". " entrées dans les données cibles actives.\n"; echo $line; flush(); $log .= $line ."<br>"; $read = new DateTime(); echo "Lecture: ".$read->format('d/m/y H:i:s:u'). "(" . ($read->diff($debut))->format('%H:%m:%s:%F').")\n"; flush(); $line = "Lecture: ".$read->format('d/m/y H:i:s:u'). "(" . ($read->diff($debut))->format('%H:%m:%s:%F').")\n"; echo $line; flush(); $log .= $line ."<br>"; //check for removal $nbRetrait = 0; // $texte_retrait = ""; foreach ($data_destination as $id => $item) { if ($item['deleted_on'] === null AND !isset($data_source[$id])) { $nbRetrait++; // $texte_retrait .= "Retrait de ".$id." des données destination.\n"; $this->getSqlHelperService()->delete($orm_destination, $table_destination, $id); } } echo "#Retrait: ".$nbRetrait."\n"; flush(); // $log .= $texte_retrait; $line = "#Retrait: ".$nbRetrait."\n"; echo $line; flush(); $log .= $line ."<br>"; //check for adding $nbAjout = 0; // $texte_ajout = ""; foreach ($data_source as $id => $item) { if (!isset($data_destination[$id])) { $nbAjout++; // $texte_ajout .= "Ajout de ".$id." des données sources.\n"; $this->getSqlHelperService()->insert($orm_destination, $table_destination, $item, $correspondance, $source); } } echo "#Ajout: ".$nbAjout."\n"; flush(); // $log .= $texte_ajout; $line = "#Ajout: ".$nbAjout."\n"; echo $line; flush(); $log .= $line ."<br>"; //check for restauration $nbRestauration = 0; // $texte_restauration = ""; foreach ($data_source as $id => $item) { if (isset($data_destination[$id]) AND $data_destination[$id]["deleted_on"] !== null) { $nbRestauration++; // $texte_restauration .= "Restauration de ".$id." des données destinations.\n"; $this->getSqlHelperService()->restore($orm_destination, $table_destination, $id); } } echo "#Restauration: ".$nbRestauration."\n"; flush(); // $log .= $texte_restauration; $line = "#Restauration: ".$nbRestauration."\n"; echo $line; flush(); $log .= $line ."<br>"; //check for modification $nbModification = 0; // $texte_modication = ""; foreach ($data_source as $id => $item) { if (isset($data_destination[$id]) AND $this->checkDifferences($item, $data_destination[$id], $correspondance, $source)) { $nbModification++; // $texte_modication .= "Modif de ".$id." des données sources.\n"; $this->getSqlHelperService()->update($orm_destination, $table_destination, $item, $correspondance, $id, $source); } } echo "#Modification: ".$nbModification."\n"; flush(); // $log .= $texte_modication; $line .= "#Modification: ".$nbModification."\n"; echo $line; flush(); $log .= $line ."<br>"; $fin = new DateTime(); echo "Fin: ".$fin->format('d/m/y H:i:s:u')."\n"; echo "Durée de la synchronisation: " . ($fin->diff($debut))->format('%H:%m:%s:%F') . "\n"; $line = "Fin: ".$fin->format('d/m/y H:i:s:u')."\n"; echo $line; flush(); $log .= $line ."<br>"; $line = "Durée de la synchronisation: " . ($fin->diff($debut))->format('%H:%m:%s:%F') . "\n"; echo $line; flush(); $log .= $line ."<br>"; return ""; return $log; } } No newline at end of file