From 09f29cd577f0d9ef150a609b2870380af71882a2 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 25 May 2021 13:11:23 +0000 Subject: [PATCH 1/2] Avoid notices because of empty fields --- src/Model/APContact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/APContact.php b/src/Model/APContact.php index 28bb31c83..8795b22aa 100644 --- a/src/Model/APContact.php +++ b/src/Model/APContact.php @@ -361,7 +361,7 @@ class APContact Logger::info('Updated profile', ['url' => $url]); - return $apcontact; + return DBA::selectFirst('apcontact', [], ['url' => $apcontact['url']]) ?: []; } /** From ee5209a847eb9daa38a9ce49a76f255a8847f9a1 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 25 May 2021 13:18:48 +0000 Subject: [PATCH 2/2] Improved logging --- src/Util/HTTPSignature.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Util/HTTPSignature.php b/src/Util/HTTPSignature.php index 584ac356f..3980b7fba 100644 --- a/src/Util/HTTPSignature.php +++ b/src/Util/HTTPSignature.php @@ -640,16 +640,17 @@ class HTTPSignature $profile = APContact::getByURL($url); if (!empty($profile)) { - Logger::log('Taking key from id ' . $id, Logger::DEBUG); + Logger::info('Taking key from id', ['id' => $id]); return ['url' => $url, 'pubkey' => $profile['pubkey'], 'type' => $profile['type']]; } elseif ($url != $actor) { $profile = APContact::getByURL($actor); if (!empty($profile)) { - Logger::log('Taking key from actor ' . $actor, Logger::DEBUG); + Logger::info('Taking key from actor', ['actor' => $actor]); return ['url' => $actor, 'pubkey' => $profile['pubkey'], 'type' => $profile['type']]; } } + Logger::notice('Key could not be fetched', ['url' => $url, 'actor' => $actor]); return false; } }