Merge pull request #14600 from annando/warnings

Fix some notices / reduce the number of warnings
This commit is contained in:
Hypolite Petovan 2024-12-17 07:18:51 -05:00 committed by GitHub
commit 1aca64d0d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 8 deletions

View file

@ -176,7 +176,7 @@ class Processor
if ($id) { if ($id) {
$this->logger->info('Post inserted', ['id' => $id, 'guid' => $item['guid']]); $this->logger->info('Post inserted', ['id' => $id, 'guid' => $item['guid']]);
} elseif (Post::exists(['uid' => $uid, 'uri-id' => $item['uri-id']])) { } elseif (Post::exists(['uid' => $uid, 'uri-id' => $item['uri-id']])) {
$this->logger->warning('Post was found', ['guid' => $item['guid'], 'uri' => $item['uri']]); $this->logger->notice('Post was found', ['guid' => $item['guid'], 'uri' => $item['uri']]);
} else { } else {
$this->logger->warning('Post was not inserted', ['guid' => $item['guid'], 'uri' => $item['uri']]); $this->logger->warning('Post was not inserted', ['guid' => $item['guid'], 'uri' => $item['uri']]);
} }
@ -206,7 +206,7 @@ class Processor
if ($id) { if ($id) {
$this->logger->info('Repost inserted', ['id' => $id]); $this->logger->info('Repost inserted', ['id' => $id]);
} elseif (Post::exists(['uid' => $uid, 'uri-id' => $item['uri-id']])) { } elseif (Post::exists(['uid' => $uid, 'uri-id' => $item['uri-id']])) {
$this->logger->warning('Repost was found', ['uri' => $item['uri']]); $this->logger->notice('Repost was found', ['uri' => $item['uri']]);
} else { } else {
$this->logger->warning('Repost was not inserted', ['uri' => $item['uri']]); $this->logger->warning('Repost was not inserted', ['uri' => $item['uri']]);
} }
@ -235,7 +235,7 @@ class Processor
if ($id) { if ($id) {
$this->logger->info('Like inserted', ['id' => $id]); $this->logger->info('Like inserted', ['id' => $id]);
} elseif (Post::exists(['uid' => $uid, 'uri-id' => $item['uri-id']])) { } elseif (Post::exists(['uid' => $uid, 'uri-id' => $item['uri-id']])) {
$this->logger->warning('Like was found', ['uri' => $item['uri']]); $this->logger->notice('Like was found', ['uri' => $item['uri']]);
} else { } else {
$this->logger->warning('Like was not inserted', ['uri' => $item['uri']]); $this->logger->warning('Like was not inserted', ['uri' => $item['uri']]);
} }
@ -315,7 +315,7 @@ class Processor
if ($id) { if ($id) {
$this->logger->info('Fetched post inserted', ['id' => $id, 'guid' => $item['guid']]); $this->logger->info('Fetched post inserted', ['id' => $id, 'guid' => $item['guid']]);
} elseif (Post::exists(['uid' => $uid, 'uri-id' => $item['uri-id']])) { } elseif (Post::exists(['uid' => $uid, 'uri-id' => $item['uri-id']])) {
$this->logger->warning('Fetched post was found', ['guid' => $item['guid'], 'uri' => $item['uri']]); $this->logger->notice('Fetched post was found', ['guid' => $item['guid'], 'uri' => $item['uri']]);
} else { } else {
$this->logger->warning('Fetched post was not inserted', ['guid' => $item['guid'], 'uri' => $item['uri']]); $this->logger->warning('Fetched post was not inserted', ['guid' => $item['guid'], 'uri' => $item['uri']]);
} }

View file

@ -161,7 +161,7 @@ class Delivery
} }
Logger::notice('Delivery failed', ['retcode' => $response->getReturnCode(), 'serverfailure' => $serverfail, 'drop' => $drop, 'runtime' => round($runtime, 3), 'uri-id' => $uri_id, 'uid' => $uid, 'item_id' => $item_id, 'cmd' => $cmd, 'inbox' => $inbox]); Logger::notice('Delivery failed', ['retcode' => $response->getReturnCode() ?? 0, 'serverfailure' => $serverfail, 'drop' => $drop, 'runtime' => round($runtime, 3), 'uri-id' => $uri_id, 'uid' => $uid, 'item_id' => $item_id, 'cmd' => $cmd, 'inbox' => $inbox]);
} }
if ($uri_id) { if ($uri_id) {
if ($success) { if ($success) {

View file

@ -127,7 +127,6 @@ class JsonLD
$messages[] = $currentException->getMessage(); $messages[] = $currentException->getMessage();
} while ($currentException = $currentException->getPrevious()); } while ($currentException = $currentException->getPrevious());
Logger::warning('JsonLD normalize error');
Logger::notice('JsonLD normalize error', ['messages' => $messages]); Logger::notice('JsonLD normalize error', ['messages' => $messages]);
Logger::info('JsonLD normalize error', ['trace' => $e->getTraceAsString()]); Logger::info('JsonLD normalize error', ['trace' => $e->getTraceAsString()]);
Logger::debug('JsonLD normalize error', ['jsonobj' => $jsonobj]); Logger::debug('JsonLD normalize error', ['jsonobj' => $jsonobj]);

View file

@ -451,6 +451,10 @@ class Notifier
} }
$cdata = Contact::getPublicAndUserContactID($contact['id'], $sender_uid); $cdata = Contact::getPublicAndUserContactID($contact['id'], $sender_uid);
if (empty($cdata)) {
Logger::info('No contact entry found', ['id' => $contact['id'], 'uid' => $sender_uid]);
continue;
}
if (in_array($cdata['public'] ?: $contact['id'], $ap_contacts)) { if (in_array($cdata['public'] ?: $contact['id'], $ap_contacts)) {
Logger::info('The public contact is already delivered via AP, so skip delivery via legacy DFRN/Diaspora', ['batch' => $in_batch, 'target' => $post_uriid, 'uid' => $sender_uid, 'contact' => $contact['url']]); Logger::info('The public contact is already delivered via AP, so skip delivery via legacy DFRN/Diaspora', ['batch' => $in_batch, 'target' => $post_uriid, 'uid' => $sender_uid, 'contact' => $contact['url']]);
continue; continue;
@ -637,8 +641,8 @@ class Notifier
private static function activityPubDelivery($cmd, array $target_item, array $parent, array $thr_parent, int $priority, string $created, array $recipients): array private static function activityPubDelivery($cmd, array $target_item, array $parent, array $thr_parent, int $priority, string $created, array $recipients): array
{ {
// Don't deliver via AP when the starting post isn't from a federated network // Don't deliver via AP when the starting post isn't from a federated network
if (!in_array($parent['network'], Protocol::FEDERATED)) { if (!in_array($parent['network'] ?? '', Protocol::FEDERATED)) {
Logger::info('Parent network is no federated network, so no AP delivery', ['network' => $parent['network']]); Logger::info('Parent network is no federated network, so no AP delivery', ['network' => $parent['network'] ?? '']);
return ['count' => 0, 'contacts' => []]; return ['count' => 0, 'contacts' => []];
} }