Merge branch 'develop' into trunk

This commit is contained in:
Vincent BRIDIER 2022-04-20 17:34:19 +02:00
commit f6e0e96e62
No known key found for this signature in database
GPG key ID: 8571BFA20420D512

View file

@ -114,7 +114,15 @@ class XmlArcadiaMediasIn extends XmlJobs
$arcadiaLink->delete();
}
$media->removeFromIndex();
// * Index ElasticSearch
$esExist = Media::searchByQuery([
'match' => ['arcadia_id' => $media->arcadia_id ?? '']
]);
// * Remove all from elastic if any duplicates
if ($esExist->totalHits() > 0) {
$media->removeFromIndex();
}
if (!$media->trashed()) {
// * Save into elastic
$media->addToIndex();
@ -124,6 +132,7 @@ class XmlArcadiaMediasIn extends XmlJobs
$report = new ElasticSearchException(
'Something went wrong when updating media into elastic search',
0,
1,
__FILE__,
__LINE__,
$e