Loading module/StepStar/src/StepStar/Entity/Db/Log.php +17 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ class Log private DateTime $startedOn; private DateTime $endedOn; private bool $hasProblems = false; private ?string $tag = null; private ?int $theseId = null; private ?These $these = null; Loading Loading @@ -256,6 +257,22 @@ class Log $this->hasProblems = $hasProblems; } /** * @return string|null */ public function getTag(): ?string { return $this->tag; } /** * @param string|null $tag */ public function setTag(?string $tag): void { $this->tag = $tag; } /** * @return int|null */ Loading module/StepStar/src/StepStar/Entity/Db/Mapping/StepStar.Entity.Db.Log.dcm.xml +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ <field name="tefFileContentHash" column="TEF_FILE_CONTENT_HASH"/> <field name="tefFileContent" column="TEF_FILE_CONTENT"/> <field name="hasProblems" type="boolean" column="HAS_PROBLEMS"/> <field name="tag" column="TAG"/> <many-to-one field="these" target-entity="These\Entity\Db\These"> <join-columns> Loading module/StepStar/src/StepStar/Facade/EnvoiFacade.php +4 −5 Original line number Diff line number Diff line Loading @@ -55,12 +55,14 @@ class EnvoiFacade $inputDir = sys_get_temp_dir() . '/' . uniqid('sygal_xml_input_'); $outputDir = sys_get_temp_dir() . '/' . uniqid('sygal_xml_output_'); $logTag = uniqid(); // tag commun à l'ensemble des logs produits ici /** * Generation du fichier XML intermediaire (1 pour N theses) & des fichiers TEF (1 par these). * (Un Log unique est créé pour cette opération.) */ $operation = Log::OPERATION__GENERATION_XML; $this->newLog($operation, $command); $this->newLog($operation, $command, $logTag); $success = true; try { $this->genererXmlForThesesInDir($theses, $inputDir); Loading @@ -82,15 +84,12 @@ class EnvoiFacade * (Un Log par thèse est créé.) */ $operation = Log::OPERATION__ENVOI; // $this->newLog($operation, $command); // $this->appendToLog("Envoi vers STEP/STAR des fichiers TEF presents dans $outputDir :"); // yield $this->log; $tefFilesPaths = $this->listXmlFilesInDirectory($outputDir); foreach ($tefFilesPaths as $i => $tefFilePath) { $theseId = $this->extractTheseIdFromTefFilePath($tefFilePath); $these = $theses[$theseId]; $lastLog = $this->findLastLogForTheseAndOperation($theseId, $operation); $this->newLogForThese($theseId, $operation, $command); $this->newLogForThese($theseId, $operation, $command, $logTag); $this->log->setTefFileContentHash(md5_file($tefFilePath)); $success = true; $doctorantIdentite = $these['doctorant']['individu']['nomUsuel'] . ' ' . $these['doctorant']['individu']['prenom1']; Loading module/StepStar/src/StepStar/Service/Log/LogService.php +8 −3 Original line number Diff line number Diff line Loading @@ -27,9 +27,10 @@ class LogService * * @param string|null $operation * @param string|null $command * @param string|null $tag * @return \StepStar\Entity\Db\Log */ public function newLog(?string $operation = null, ?string $command = null): Log public function newLog(?string $operation = null, ?string $command = null, ?string $tag = null): Log { $log = new Log(); if ($operation) { Loading @@ -38,6 +39,9 @@ class LogService if ($command) { $log->setCommand($command); } if ($tag) { $log->setTag($tag); } $log->setStartedOn(); return $log; Loading @@ -49,11 +53,12 @@ class LogService * @param int $theseId * @param string|null $operation * @param string|null $command * @param string|null $tag * @return \StepStar\Entity\Db\Log */ public function newLogForThese(int $theseId, ?string $operation = null, ?string $command = null): Log public function newLogForThese(int $theseId, ?string $operation = null, ?string $command = null, ?string $tag = null): Log { $log = $this->newLog($operation, $command); $log = $this->newLog($operation, $command, $tag); $log->setTheseId($theseId); return $log; Loading module/StepStar/src/StepStar/Service/Log/LogServiceAwareTrait.php +5 −4 Original line number Diff line number Diff line Loading @@ -15,10 +15,11 @@ trait LogServiceAwareTrait * * @param string|null $operation * @param string|null $command * @param string|null $tag */ protected function newLog(?string $operation = null, ?string $command = null) protected function newLog(?string $operation = null, ?string $command = null, ?string $tag = null) { $this->log = $this->logService->newLog($operation, $command); $this->log = $this->logService->newLog($operation, $command, $tag); } /** Loading @@ -28,9 +29,9 @@ trait LogServiceAwareTrait * @param string $operation * @param string $command */ protected function newLogForThese(int $theseId, string $operation, string $command) protected function newLogForThese(int $theseId, string $operation, string $command, ?string $tag = null) { $this->log = $this->logService->newLogForThese($theseId, $operation, $command); $this->log = $this->logService->newLogForThese($theseId, $operation, $command, $tag); } /** Loading Loading
module/StepStar/src/StepStar/Entity/Db/Log.php +17 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ class Log private DateTime $startedOn; private DateTime $endedOn; private bool $hasProblems = false; private ?string $tag = null; private ?int $theseId = null; private ?These $these = null; Loading Loading @@ -256,6 +257,22 @@ class Log $this->hasProblems = $hasProblems; } /** * @return string|null */ public function getTag(): ?string { return $this->tag; } /** * @param string|null $tag */ public function setTag(?string $tag): void { $this->tag = $tag; } /** * @return int|null */ Loading
module/StepStar/src/StepStar/Entity/Db/Mapping/StepStar.Entity.Db.Log.dcm.xml +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ <field name="tefFileContentHash" column="TEF_FILE_CONTENT_HASH"/> <field name="tefFileContent" column="TEF_FILE_CONTENT"/> <field name="hasProblems" type="boolean" column="HAS_PROBLEMS"/> <field name="tag" column="TAG"/> <many-to-one field="these" target-entity="These\Entity\Db\These"> <join-columns> Loading
module/StepStar/src/StepStar/Facade/EnvoiFacade.php +4 −5 Original line number Diff line number Diff line Loading @@ -55,12 +55,14 @@ class EnvoiFacade $inputDir = sys_get_temp_dir() . '/' . uniqid('sygal_xml_input_'); $outputDir = sys_get_temp_dir() . '/' . uniqid('sygal_xml_output_'); $logTag = uniqid(); // tag commun à l'ensemble des logs produits ici /** * Generation du fichier XML intermediaire (1 pour N theses) & des fichiers TEF (1 par these). * (Un Log unique est créé pour cette opération.) */ $operation = Log::OPERATION__GENERATION_XML; $this->newLog($operation, $command); $this->newLog($operation, $command, $logTag); $success = true; try { $this->genererXmlForThesesInDir($theses, $inputDir); Loading @@ -82,15 +84,12 @@ class EnvoiFacade * (Un Log par thèse est créé.) */ $operation = Log::OPERATION__ENVOI; // $this->newLog($operation, $command); // $this->appendToLog("Envoi vers STEP/STAR des fichiers TEF presents dans $outputDir :"); // yield $this->log; $tefFilesPaths = $this->listXmlFilesInDirectory($outputDir); foreach ($tefFilesPaths as $i => $tefFilePath) { $theseId = $this->extractTheseIdFromTefFilePath($tefFilePath); $these = $theses[$theseId]; $lastLog = $this->findLastLogForTheseAndOperation($theseId, $operation); $this->newLogForThese($theseId, $operation, $command); $this->newLogForThese($theseId, $operation, $command, $logTag); $this->log->setTefFileContentHash(md5_file($tefFilePath)); $success = true; $doctorantIdentite = $these['doctorant']['individu']['nomUsuel'] . ' ' . $these['doctorant']['individu']['prenom1']; Loading
module/StepStar/src/StepStar/Service/Log/LogService.php +8 −3 Original line number Diff line number Diff line Loading @@ -27,9 +27,10 @@ class LogService * * @param string|null $operation * @param string|null $command * @param string|null $tag * @return \StepStar\Entity\Db\Log */ public function newLog(?string $operation = null, ?string $command = null): Log public function newLog(?string $operation = null, ?string $command = null, ?string $tag = null): Log { $log = new Log(); if ($operation) { Loading @@ -38,6 +39,9 @@ class LogService if ($command) { $log->setCommand($command); } if ($tag) { $log->setTag($tag); } $log->setStartedOn(); return $log; Loading @@ -49,11 +53,12 @@ class LogService * @param int $theseId * @param string|null $operation * @param string|null $command * @param string|null $tag * @return \StepStar\Entity\Db\Log */ public function newLogForThese(int $theseId, ?string $operation = null, ?string $command = null): Log public function newLogForThese(int $theseId, ?string $operation = null, ?string $command = null, ?string $tag = null): Log { $log = $this->newLog($operation, $command); $log = $this->newLog($operation, $command, $tag); $log->setTheseId($theseId); return $log; Loading
module/StepStar/src/StepStar/Service/Log/LogServiceAwareTrait.php +5 −4 Original line number Diff line number Diff line Loading @@ -15,10 +15,11 @@ trait LogServiceAwareTrait * * @param string|null $operation * @param string|null $command * @param string|null $tag */ protected function newLog(?string $operation = null, ?string $command = null) protected function newLog(?string $operation = null, ?string $command = null, ?string $tag = null) { $this->log = $this->logService->newLog($operation, $command); $this->log = $this->logService->newLog($operation, $command, $tag); } /** Loading @@ -28,9 +29,9 @@ trait LogServiceAwareTrait * @param string $operation * @param string $command */ protected function newLogForThese(int $theseId, string $operation, string $command) protected function newLogForThese(int $theseId, string $operation, string $command, ?string $tag = null) { $this->log = $this->logService->newLogForThese($theseId, $operation, $command); $this->log = $this->logService->newLogForThese($theseId, $operation, $command, $tag); } /** Loading