From: Hypolite Petovan Date: Mon, 14 Dec 2020 14:10:43 +0000 (-0500) Subject: Account for inbox array in Worker/APDelivery X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=481c5c9e81f0eded399c5bdc3c25b27f7a628018;p=friendica.git Account for inbox array in Worker/APDelivery - Address https://github.com/friendica/friendica/issues/9250#issuecomment-744339671 --- diff --git a/src/Worker/APDelivery.php b/src/Worker/APDelivery.php index 7173475bef..c98f1e3993 100644 --- a/src/Worker/APDelivery.php +++ b/src/Worker/APDelivery.php @@ -31,6 +31,28 @@ use Friendica\Util\HTTPSignature; class APDelivery { + /** + * Delivers ActivityPub messages + * + * @param string $cmd + * @param integer $target_id + * @param string|array $inboxes + * @param integer $uid + * @param array $receivers + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException + */ + public static function execute(string $cmd, int $target_id, $inboxes, int $uid, array $receivers = []) + { + if (is_string($inboxes)) { + $inboxes = [$inboxes]; + } + + foreach ($inboxes as $inbox) { + self::perform($cmd, $target_id, $inbox, $uid, $receivers); + } + } + /** * Delivers ActivityPub messages * @@ -42,7 +64,7 @@ class APDelivery * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \ImagickException */ - public static function execute($cmd, $target_id, $inbox, $uid, $receivers = []) + private static function perform(string $cmd, int $target_id, string $inbox, int $uid, array $receivers = []) { if (ActivityPub\Transmitter::archivedInbox($inbox)) { Logger::info('Inbox is archived', ['cmd' => $cmd, 'inbox' => $inbox, 'id' => $target_id, 'uid' => $uid]);