From: Michael Date: Fri, 13 May 2022 02:18:46 +0000 (+0000) Subject: Remove all posts of a given inbox X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2595b5e12f525c86d6e941579bf41cad3eafe76d;p=friendica.git Remove all posts of a given inbox --- diff --git a/src/Worker/APDelivery.php b/src/Worker/APDelivery.php index 1ec0ba47ce..3fb389313f 100644 --- a/src/Worker/APDelivery.php +++ b/src/Worker/APDelivery.php @@ -49,12 +49,21 @@ class APDelivery if (ActivityPub\Transmitter::archivedInbox($inbox)) { Logger::info('Inbox is archived', ['cmd' => $cmd, 'inbox' => $inbox, 'id' => $item_id, 'uri-id' => $uri_id, 'uid' => $uid]); if (in_array($cmd, [Delivery::POST])) { - if (empty($uri_id)) { + if (empty($uri_id) && !empty($item_id)) { $item = Post::selectFirst(['uri-id'], ['id' => $item_id]); $uri_id = $item['uri-id'] ?? 0; } - Post\Delivery::remove($uri_id, $inbox); - Post\DeliveryData::incrementQueueFailed($uri_id); + if (empty($uri_id)) { + $posts = Post\Delivery::selectForInbox($inbox); + $uri_ids = array_column($posts, 'uri-id'); + } else { + $uri_ids = [$uri_id]; + } + + foreach ($uri_ids as $uri_id) { + Post\Delivery::remove($uri_id, $inbox); + Post\DeliveryData::incrementQueueFailed($uri_id); + } } return; }