]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/Delivery.php
Merge remote-tracking branch 'origin/2022.12-rc' into fixes
[friendica.git] / src / Worker / Delivery.php
index d90b80e6fdf63cdf8edd35a788143075c87f9905..1a0758987aa98554f95f9e0e35979809f93c8a4f 100644 (file)
@@ -29,7 +29,6 @@ use Friendica\Core\Worker;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
-use Friendica\Model\FContact;
 use Friendica\Model\GServer;
 use Friendica\Model\Item;
 use Friendica\Model\Post;
@@ -94,7 +93,7 @@ class Delivery
                                if ($item['verb'] == Activity::ANNOUNCE) {
                                        continue;
                                }
-       
+
                                if ($item['id'] == $parent_id) {
                                        $parent = $item;
                                }
@@ -246,6 +245,8 @@ class Delivery
         *
         * @param string $cmd  Command
         * @param array  $item Item array
+        *
+        * @return void
         */
        private static function setFailedQueue(string $cmd, array $item)
        {
@@ -268,13 +269,15 @@ class Delivery
         * @param boolean  $top_level       Is it a thread starter?
         * @param boolean  $followup        Is it an answer to a remote post?
         * @param int|null $server_protocol The protocol of the server
+        *
+        * @return void
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
        private static function deliverDFRN(string $cmd, array $contact, array $owner, array $items, array $target_item, bool $public_message, bool $top_level, bool $followup, int $server_protocol = null)
        {
                // Transmit Diaspora reshares via Diaspora if the Friendica contact support Diaspora
-               if (Diaspora::getReshareDetails($target_item ?? []) && !empty(FContact::getByURL($contact['addr'], false))) {
+               if (Diaspora::getReshareDetails($target_item ?? []) && Diaspora::isSupportedByContactUrl($contact['addr'])) {
                        Logger::info('Reshare will be transmitted via Diaspora', ['url' => $contact['url'], 'guid' => ($target_item['guid'] ?? '') ?: $target_item['id']]);
                        self::deliverDiaspora($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup);
                        return;
@@ -303,8 +306,8 @@ class Delivery
                                foreach ($items as $item) {
                                        // Only add the parent when we don't delete other items.
                                        if (($target_item['id'] == $item['id']) || ($cmd != self::DELETION)) {
-                                               $item["entry:comment-allow"] = true;
-                                               $item["entry:cid"] = ($top_level ? $contact['id'] : 0);
+                                               $item['entry:comment-allow'] = true;
+                                               $item['entry:cid'] = ($top_level ? $contact['id'] : 0);
                                                $msgitems[] = $item;
                                        }
                                }
@@ -312,7 +315,7 @@ class Delivery
                        $atom = DFRN::entries($msgitems, $owner);
                }
 
-               Logger::debug('Notifier entry: ' . $contact["url"] . ' ' . (($target_item['guid'] ?? '') ?: $target_item['id']) . ' entry: ' . $atom);
+               Logger::debug('Notifier entry: ' . $contact['url'] . ' ' . (($target_item['guid'] ?? '') ?: $target_item['id']) . ' entry: ' . $atom);
 
                $protocol = Post\DeliveryData::DFRN;
 
@@ -326,7 +329,7 @@ class Delivery
 
                        // We never spool failed relay deliveries
                        if ($public_dfrn) {
-                               Logger::info('Relay delivery to ' . $contact["url"] . ' with guid ' . $target_item["guid"] . ' returns ' . $deliver_status);
+                               Logger::info('Relay delivery to ' . $contact['url'] . ' with guid ' . $target_item['guid'] . ' returns ' . $deliver_status);
 
                                if ($cmd == Delivery::POST) {
                                        if (($deliver_status >= 200) && ($deliver_status <= 299)) {
@@ -383,6 +386,8 @@ class Delivery
         * @param boolean $public_message Is the content public?
         * @param boolean $top_level      Is it a thread starter?
         * @param boolean $followup       Is it an answer to a remote post?
+        *
+        * @return void
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
@@ -477,6 +482,7 @@ class Delivery
         * @param array  $owner       Owner record of the sender
         * @param array  $target_item Item record of the content
         * @param array  $thr_parent  Item record of the direct parent in the thread
+        *
         * @return void
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException