From 19b5362f93e6e539acacf699acf12d74547b61c1 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 30 Dec 2022 01:46:11 -0500 Subject: [PATCH] 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 --- src/Util/HTTPSignature.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Util/HTTPSignature.php b/src/Util/HTTPSignature.php index 47000f5c74..84219b3114 100644 --- a/src/Util/HTTPSignature.php +++ b/src/Util/HTTPSignature.php @@ -332,6 +332,7 @@ class HTTPSignature * @param string $url The URL of the inbox * @param boolean $success Transmission status * @param boolean $shared The inbox is a shared inbox + * @throws \Exception */ static public function setInboxStatus(string $url, bool $success, bool $shared = false) { @@ -339,7 +340,12 @@ class HTTPSignature $status = DBA::selectFirst('inbox-status', [], ['url' => $url]); 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]); }