]> git.mxchange.org Git - friendica.git/commitdiff
Removing some notices again
authorMichael <heluecht@pirati.ca>
Sun, 11 Nov 2018 12:15:17 +0000 (12:15 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 11 Nov 2018 12:15:17 +0000 (12:15 +0000)
src/Protocol/PortableContact.php
src/Worker/Delivery.php

index 7243da523f9d2e6078b1d4371f66b519838c68ea..0f4ef12f9dd4943a9b11bc360352f18afa593479 100644 (file)
@@ -1376,10 +1376,11 @@ class PortableContact
                                        }
 
                                        $info = $data['info'];
-                                       if (in_array($data['register_policy'], ['REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'])) {
+                                       $register_policy = defaults($data, 'register_policy', REGISTER_CLOSED);
+                                       if (in_array($register_policy, ['REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'])) {
                                                $register_policy = constant($data['register_policy']);
                                        } else {
-                                               Logger::log("Register policy '{$data['register_policy']}' from $server_url is invalid.");
+                                               Logger::log("Register policy '$register_policy' from $server_url is invalid.");
                                                $register_policy = REGISTER_CLOSED; // set a default value
                                        }
                                        $platform = $data['platform'];
index 40230e3bdb3ec1aeacf4abe08283d9ba27e021f3..3ae0be140dcdc15a1c68d48fd186e9f497e40b8f 100644 (file)
@@ -214,7 +214,7 @@ class Delivery extends BaseObject
         */
        private static function deliverDFRN($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup)
        {
-               Logger::log('Deliver ' . $target_item["guid"] . ' via DFRN to ' . (empty($contact['addr']) ? $contact['url'] : $contact['addr']));
+               Logger::log('Deliver ' . defaults($target_item, 'guid', $target_item['id']) . ' via DFRN to ' . (empty($contact['addr']) ? $contact['url'] : $contact['addr']));
 
                if ($cmd == self::MAIL) {
                        $item = $target_item;
@@ -242,7 +242,7 @@ class Delivery extends BaseObject
                        $atom = DFRN::entries($msgitems, $owner);
                }
 
-               Logger::log('Notifier entry: ' . $contact["url"] . ' ' . $target_item["guid"] . ' entry: ' . $atom, Logger::DATA);
+               Logger::log('Notifier entry: ' . $contact["url"] . ' ' . defaults($target_item, 'guid', $target_item['id']) . ' entry: ' . $atom, Logger::DATA);
 
                $basepath =  implode('/', array_slice(explode('/', $contact['url']), 0, 3));
 
@@ -301,10 +301,10 @@ class Delivery extends BaseObject
                        $deliver_status = DFRN::deliver($owner, $contact, $atom, false, true);
                }
 
-               Logger::log('Delivery to ' . $contact["url"] . ' with guid ' . $target_item["guid"] . ' returns ' . $deliver_status);
+               Logger::log('Delivery to ' . $contact['url'] . ' with guid ' . defaults($target_item, 'guid', $target_item['id']) . ' returns ' . $deliver_status);
 
                if ($deliver_status < 0) {
-                       Logger::log('Delivery failed: queuing message ' . $target_item["guid"] );
+                       Logger::log('Delivery failed: queuing message ' . defaults($target_item, 'guid', $target_item['id']));
                        Queue::add($contact['id'], Protocol::DFRN, $atom, false, $target_item['guid']);
                }
 
@@ -344,7 +344,7 @@ class Delivery extends BaseObject
                        $loc = $contact['addr'];
                }
 
-               Logger::log('Deliver ' . $target_item["guid"] . ' via Diaspora to ' . $loc);
+               Logger::log('Deliver ' . defaults($target_item, 'guid', $target_item['id']) . ' via Diaspora to ' . $loc);
 
                if (Config::get('system', 'dfrn_only') || !Config::get('system', 'diaspora_enabled')) {
                        return;
@@ -360,14 +360,14 @@ class Delivery extends BaseObject
                if (!$contact['pubkey'] && !$public_message) {
                        return;
                }
-               if (($target_item['deleted']) && (($target_item['uri'] === $target_item['parent-uri']) || $followup)) {
+               if ($cmd == self::RELOCATION) {
+                       Diaspora::sendAccountMigration($owner, $contact, $owner['uid']);
+                       return;
+               } elseif ($target_item['deleted'] && (($target_item['uri'] === $target_item['parent-uri']) || $followup)) {
                        // top-level retraction
                        Logger::log('diaspora retract: ' . $loc);
                        Diaspora::sendRetraction($target_item, $owner, $contact, $public_message);
                        return;
-               } elseif ($cmd == self::RELOCATION) {
-                       Diaspora::sendAccountMigration($owner, $contact, $owner['uid']);
-                       return;
                } elseif ($followup) {
                        // send comments and likes to owner to relay
                        Logger::log('diaspora followup: ' . $loc);