forked from friendica/friendica-addons
a bit more defensiveness about add_retriever_item
This commit is contained in:
parent
13f3b44522
commit
fafe6a2ea4
|
@ -448,8 +448,10 @@ function retriever_on_item_insert(array $retriever, array &$item) {
|
|||
}
|
||||
|
||||
$resource = add_retriever_resource($url, $item['uid'], $item['contact-id']);
|
||||
if (is_array($resource)) {
|
||||
$retriever_item_id = add_retriever_item($item, $resource);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a new resource to be downloaded from the supplied URL. Unique resources are created for each URL, UID and contact ID, because different contact IDs may have different rules for how to retrieve them. If the URL is actually a data URL, the resource is completed immediately.
|
||||
|
@ -744,15 +746,18 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks if an item has been completed, i.e. all its associated retriever_item rows have been retrieved. If so, update the item to be visible again.
|
||||
|
|
Loading…
Reference in a new issue