Return early when inbox-status row couldn't be inserted in HTTPSignature->setInboxStatus

- Address https://github.com/friendica/friendica/issues/12488?notification_referrer_id=NT_kwDOAA4e57E1MTM1MzE3MjU2OjkyNTQxNQ#issuecomment-1366991471
This commit is contained in:
Hypolite Petovan 2022-12-30 01:46:11 -05:00
parent 6e31b8d6a5
commit 19b5362f93

View File

@ -332,6 +332,7 @@ class HTTPSignature
* @param string $url The URL of the inbox * @param string $url The URL of the inbox
* @param boolean $success Transmission status * @param boolean $success Transmission status
* @param boolean $shared The inbox is a shared inbox * @param boolean $shared The inbox is a shared inbox
* @throws \Exception
*/ */
static public function setInboxStatus(string $url, bool $success, bool $shared = false) static public function setInboxStatus(string $url, bool $success, bool $shared = false)
{ {
@ -339,7 +340,12 @@ class HTTPSignature
$status = DBA::selectFirst('inbox-status', [], ['url' => $url]); $status = DBA::selectFirst('inbox-status', [], ['url' => $url]);
if (!DBA::isResult($status)) { if (!DBA::isResult($status)) {
DBA::insert('inbox-status', ['url' => $url, 'uri-id' => ItemURI::getIdByURI($url), 'created' => $now, 'shared' => $shared], Database::INSERT_IGNORE); $insertFields = ['url' => $url, 'uri-id' => ItemURI::getIdByURI($url), 'created' => $now, 'shared' => $shared];
if (!DBA::insert('inbox-status', $insertFields, Database::INSERT_IGNORE)) {
Logger::warning('Unable to insert inbox-status row', $insertFields);
return;
}
$status = DBA::selectFirst('inbox-status', [], ['url' => $url]); $status = DBA::selectFirst('inbox-status', [], ['url' => $url]);
} }