+ /**
+ * @param int $self_user_id
+ * @param int $priority The priority the Notifier queue item was created with
+ * @param string $created The date the Notifier queue item was created on
+ * @return bool
+ */
+ private static function notifySelfRemoval($self_user_id, $priority, $created)
+ {
+ $owner = User::getOwnerDataById($self_user_id);
+ if (!$owner) {
+ return false;
+ }
+
+ $contacts_stmt = DBA::select('contact', [], ['self' => false, 'uid' => $self_user_id]);
+ if (!DBA::isResult($contacts_stmt)) {
+ return false;
+ }
+
+ while($contact = DBA::fetch($contacts_stmt)) {
+ Contact::terminateFriendship($owner, $contact, true);
+ }
+ DBA::close($contacts_stmt);
+
+ $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser(0);
+ foreach ($inboxes as $inbox) {
+ Logger::log('Account removal for user ' . $self_user_id . ' to ' . $inbox .' via ActivityPub', Logger::DEBUG);
+ Worker::add(['priority' => PRIORITY_NEGLIGIBLE, 'created' => $created, 'dont_fork' => true],
+ 'APDelivery', Delivery::REMOVAL, '', $inbox, $self_user_id);
+ }
+
+ return true;
+ }
+
+ /**
+ * @param string $cmd
+ * @param array $target_item
+ * @param array $parent
+ * @param int $priority The priority the Notifier queue item was created with
+ * @param string $created The date the Notifier queue item was created on
+ * @return int The number of delivery tasks created
+ */
+ private static function activityPubDelivery($cmd, array $target_item, array $parent, $priority, $created)