mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
one line for one build job
This commit is contained in:
@@ -18,7 +18,6 @@ use PHPExiftool\Driver\Metadata\MetadataBag;
|
||||
use PHPExiftool\Driver\Tag;
|
||||
use PHPExiftool\Driver\Value\Mono;
|
||||
use PHPExiftool\Driver\Value\Multi;
|
||||
use PHPExiftool\Exception\ExceptionInterface as PHPExiftoolException;
|
||||
use PHPExiftool\Exception\TagUnknown;
|
||||
use PHPExiftool\Writer;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@@ -80,26 +79,47 @@ class WriteMetadatasWorker implements WorkerInterface
|
||||
// tell that a file is in used to create subdef
|
||||
$em = $this->getEntityManager();
|
||||
$this->repoWorker->reconnect();
|
||||
$em->beginTransaction();
|
||||
|
||||
try {
|
||||
$date = new \DateTime();
|
||||
$workerRunningJob = new WorkerRunningJob();
|
||||
if (isset($payload['workerJobId'])) {
|
||||
/** @var WorkerRunningJob $workerRunningJob */
|
||||
$workerRunningJob = $this->repoWorker->find($payload['workerJobId']);
|
||||
|
||||
if ($workerRunningJob == null) {
|
||||
$this->logger->error("Given workerJobId not found !");
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
$workerRunningJob
|
||||
->setDataboxId($databoxId)
|
||||
->setRecordId($recordId)
|
||||
->setWork(MessagePublisher::WRITE_METADATAS_TYPE)
|
||||
->setWorkOn($payload['subdefName'])
|
||||
->setPublished($date->setTimestamp($payload['published']))
|
||||
->setInfo(WorkerRunningJob::ATTEMPT . $payload['count'])
|
||||
->setStatus(WorkerRunningJob::RUNNING)
|
||||
;
|
||||
|
||||
$em->persist($workerRunningJob);
|
||||
$em->flush();
|
||||
|
||||
$em->commit();
|
||||
} catch (\Exception $e) {
|
||||
$em->rollback();
|
||||
$em->flush();
|
||||
} else {
|
||||
$em->beginTransaction();
|
||||
|
||||
try {
|
||||
$date = new \DateTime();
|
||||
$workerRunningJob = new WorkerRunningJob();
|
||||
$workerRunningJob
|
||||
->setDataboxId($databoxId)
|
||||
->setRecordId($recordId)
|
||||
->setWork(MessagePublisher::WRITE_METADATAS_TYPE)
|
||||
->setWorkOn($payload['subdefName'])
|
||||
->setPublished($date->setTimestamp($payload['published']))
|
||||
->setStatus(WorkerRunningJob::RUNNING)
|
||||
;
|
||||
|
||||
$em->persist($workerRunningJob);
|
||||
$em->flush();
|
||||
|
||||
$em->commit();
|
||||
} catch (\Exception $e) {
|
||||
$em->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
$record = $databox->get_record($recordId);
|
||||
|
Reference in New Issue
Block a user