a bit more defensiveness about add_retriever_item

This commit is contained in:
Matthew Exon 2024-06-30 10:38:00 +01:00 committed by Matthew Exon
parent 13f3b44522
commit fafe6a2ea4

View file

@ -448,7 +448,9 @@ function retriever_on_item_insert(array $retriever, array &$item) {
}
$resource = add_retriever_resource($url, $item['uid'], $item['contact-id']);
$retriever_item_id = add_retriever_item($item, $resource);
if (is_array($resource)) {
$retriever_item_id = add_retriever_item($item, $resource);
}
}
/**
@ -744,12 +746,15 @@ function retrieve_images(array &$item) {
}
if (strpos($url, (string)(DI::baseUrl())) === FALSE) {
$resource = add_retriever_resource($url, $item['uid'], $item['contact-id'], true);
if (!is_array($resource)) {
Logger::error('retrieve_images: could not add resource', ['url' => $url, 'uid' => $item['uid'], 'contact-id' => $item['contact-id']]);
continue;
}
if (!$resource['completed']) {
add_retriever_item($item, $resource);
continue;
}
else {
retriever_transform_images($item, $resource);
}
retriever_transform_images($item, $resource);
}
}
}