mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 04:23:19 +00:00
stop to try to write metadata on story (#4433)
This commit is contained in:
@@ -162,50 +162,54 @@ class RecordSubscriber implements EventSubscriberInterface
|
|||||||
|
|
||||||
$databox = $this->getApplicationBox()->get_databox($databoxId);
|
$databox = $this->getApplicationBox()->get_databox($databoxId);
|
||||||
$record = $databox->get_record($recordId);
|
$record = $databox->get_record($recordId);
|
||||||
$type = $record->getType();
|
|
||||||
|
|
||||||
$subdefGroupe = $record->getDatabox()->get_subdef_structure()->getSubdefGroup($record->getType());
|
// do not try to write meta on non story record
|
||||||
|
if (!$record->isStory()) {
|
||||||
|
$type = $record->getType();
|
||||||
|
|
||||||
if ($subdefGroupe !== null) {
|
$subdefGroupe = $record->getDatabox()->get_subdef_structure()->getSubdefGroup($record->getType());
|
||||||
$toWritemetaOriginalDocument = $subdefGroupe->toWritemetaOriginalDocument();
|
|
||||||
} else {
|
|
||||||
$toWritemetaOriginalDocument = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($mediaSubdefs as $subdef) {
|
if ($subdefGroupe !== null) {
|
||||||
// check subdefmetadatarequired from the subview setup in admin
|
$toWritemetaOriginalDocument = $subdefGroupe->toWritemetaOriginalDocument();
|
||||||
// check if we want to write meta in this mime type
|
} else {
|
||||||
if (in_array(trim($subdef->get_mime()), $acceptedMimeTypes) &&
|
$toWritemetaOriginalDocument = true;
|
||||||
(
|
}
|
||||||
($subdef->get_name() == 'document' && $toWritemetaOriginalDocument) ||
|
|
||||||
$this->isSubdefMetadataUpdateRequired($databox, $type, $subdef->get_name())
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
$payload = [
|
|
||||||
'message_type' => MessagePublisher::WRITE_METADATAS_TYPE,
|
|
||||||
'payload' => [
|
|
||||||
'recordId' => $recordId,
|
|
||||||
'databoxId' => $databoxId,
|
|
||||||
'subdefName' => $subdef->get_name()
|
|
||||||
]
|
|
||||||
];
|
|
||||||
if ($subdef->is_physically_present()) {
|
|
||||||
$this->messagePublisher->publishMessage($payload, MessagePublisher::WRITE_METADATAS_TYPE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$logMessage = sprintf('Subdef "%s" is not physically present! to be passed in the retry q of "%s" ! payload >>> %s',
|
|
||||||
$subdef->get_name(),
|
|
||||||
MessagePublisher::WRITE_METADATAS_TYPE,
|
|
||||||
json_encode($payload)
|
|
||||||
);
|
|
||||||
$this->messagePublisher->pushLog($logMessage);
|
|
||||||
|
|
||||||
$this->messagePublisher->publishRetryMessage(
|
foreach ($mediaSubdefs as $subdef) {
|
||||||
$payload,
|
// check subdefmetadatarequired from the subview setup in admin
|
||||||
MessagePublisher::WRITE_METADATAS_TYPE,
|
// check if we want to write meta in this mime type
|
||||||
2,
|
if (in_array(trim($subdef->get_mime()), $acceptedMimeTypes) &&
|
||||||
'Subdef is not physically present!'
|
(
|
||||||
);
|
($subdef->get_name() == 'document' && $toWritemetaOriginalDocument) ||
|
||||||
|
$this->isSubdefMetadataUpdateRequired($databox, $type, $subdef->get_name())
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
$payload = [
|
||||||
|
'message_type' => MessagePublisher::WRITE_METADATAS_TYPE,
|
||||||
|
'payload' => [
|
||||||
|
'recordId' => $recordId,
|
||||||
|
'databoxId' => $databoxId,
|
||||||
|
'subdefName' => $subdef->get_name()
|
||||||
|
]
|
||||||
|
];
|
||||||
|
if ($subdef->is_physically_present()) {
|
||||||
|
$this->messagePublisher->publishMessage($payload, MessagePublisher::WRITE_METADATAS_TYPE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$logMessage = sprintf('Subdef "%s" is not physically present! to be passed in the retry q of "%s" ! payload >>> %s',
|
||||||
|
$subdef->get_name(),
|
||||||
|
MessagePublisher::WRITE_METADATAS_TYPE,
|
||||||
|
json_encode($payload)
|
||||||
|
);
|
||||||
|
$this->messagePublisher->pushLog($logMessage);
|
||||||
|
|
||||||
|
$this->messagePublisher->publishRetryMessage(
|
||||||
|
$payload,
|
||||||
|
MessagePublisher::WRITE_METADATAS_TYPE,
|
||||||
|
2,
|
||||||
|
'Subdef is not physically present!'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user