From 1afc0ab028b9fb60d3080674a5f25e6f2073a6da Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 1 Aug 2018 08:47:18 +0200 Subject: [PATCH] Added logging and one more reason for a notice found (#5538) * Added logging and one more reason for a notice found * And one more --- src/Network/Probe.php | 5 +++++ src/Protocol/Diaspora.php | 13 +++++-------- src/Protocol/PortableContact.php | 4 ++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Network/Probe.php b/src/Network/Probe.php index 1bc0f9d630..8f236796a9 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -944,6 +944,11 @@ class Probe $prof_data["fn"] = $data["name"]; $prof_data["key"] = $data["pubkey"]; + // This logging is for temporarily debugging reasons + if (!isset($data["poco"])) { + logger('POCO not defined for ' . profile_link, LOGGER_DEBUG); + } + logger("Result for profile ".$profile_link.": ".print_r($prof_data, true), LOGGER_DEBUG); return $prof_data; diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index e463857857..83afa61888 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -1374,15 +1374,12 @@ class Diaspora $item = Item::selectFirst($fields, $condition); if (!DBA::isResult($item)) { - if (!isset($contact["url"])) { - logger('Missing URL: ' . System::callstack() . ' - ' . json_encode($contact)); - } + $person = self::personByHandle($author); + $result = self::storeByGuid($guid, $person["url"], $uid); - $result = self::storeByGuid($guid, $contact["url"], $uid); - - if (!$result) { - $person = self::personByHandle($author); - $result = self::storeByGuid($guid, $person["url"], $uid); + // We don't have an url for items that arrived at the public dispatcher + if (!$result && !empty($contact["url"])) { + $result = self::storeByGuid($guid, $contact["url"], $uid); } if ($result) { diff --git a/src/Protocol/PortableContact.php b/src/Protocol/PortableContact.php index 3183a192f7..aa86a0002a 100644 --- a/src/Protocol/PortableContact.php +++ b/src/Protocol/PortableContact.php @@ -659,6 +659,10 @@ class PortableContact $nodeinfo2_url = ''; foreach ($nodeinfo['links'] as $link) { + if (!is_array($link) || empty($link['rel'])) { + logger('Invalid nodeinfo format for ' . $server_url, LOGGER_DEBUG); + continue; + } if ($link['rel'] == 'http://nodeinfo.diaspora.software/ns/schema/1.0') { $nodeinfo1_url = $link['href']; } elseif ($link['rel'] == 'http://nodeinfo.diaspora.software/ns/schema/2.0') {