From 90a76ec60b3c221b801c84f4ccb6e173e52c6412 Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 13 Jan 2025 13:20:33 +0000 Subject: [PATCH] Replace Logger with DI::logger() in Notifier Worker classes --- src/Worker/Notifier.php | 111 ++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 56 deletions(-) diff --git a/src/Worker/Notifier.php b/src/Worker/Notifier.php index 35e206bf38..eccb0bb602 100644 --- a/src/Worker/Notifier.php +++ b/src/Worker/Notifier.php @@ -9,7 +9,6 @@ namespace Friendica\Worker; use Exception; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Core\Worker; use Friendica\Database\DBA; @@ -46,7 +45,7 @@ class Notifier { $appHelper = DI::appHelper(); - Logger::info('Invoked', ['cmd' => $cmd, 'target' => $post_uriid, 'sender_uid' => $sender_uid]); + DI::logger()->info('Invoked', ['cmd' => $cmd, 'target' => $post_uriid, 'sender_uid' => $sender_uid]); $target_id = $post_uriid; $recipients = []; @@ -70,7 +69,7 @@ class Notifier $inboxes = ActivityPub\Transmitter::fetchTargetInboxesFromMail($target_id); foreach ($inboxes as $inbox => $receivers) { $ap_contacts = array_merge($ap_contacts, $receivers); - Logger::info('Delivery via ActivityPub', ['cmd' => $cmd, 'target' => $target_id, 'inbox' => $inbox]); + DI::logger()->info('Delivery via ActivityPub', ['cmd' => $cmd, 'target' => $target_id, 'inbox' => $inbox]); Worker::add(['priority' => Worker::PRIORITY_HIGH, 'created' => $appHelper->getQueueValue('created'), 'dont_fork' => true], 'APDelivery', $cmd, $target_id, $inbox, $uid, $receivers, $post_uriid); } @@ -88,7 +87,7 @@ class Notifier } else { $post = Post::selectFirst(['id'], ['uri-id' => $post_uriid, 'uid' => $sender_uid]); if (!DBA::isResult($post)) { - Logger::warning('Post not found', ['uri-id' => $post_uriid, 'uid' => $sender_uid]); + DI::logger()->warning('Post not found', ['uri-id' => $post_uriid, 'uid' => $sender_uid]); return; } $target_id = $post['id']; @@ -99,7 +98,7 @@ class Notifier $target_item = Post\Media::addHTMLAttachmentToItem($target_item); if (!DBA::isResult($target_item) || !intval($target_item['parent'])) { - Logger::info('No target item', ['cmd' => $cmd, 'target' => $target_id]); + DI::logger()->info('No target item', ['cmd' => $cmd, 'target' => $target_id]); return; } @@ -108,7 +107,7 @@ class Notifier } elseif (!empty($target_item['uid'])) { $uid = $target_item['uid']; } else { - Logger::info('Only public users, quitting', ['target' => $target_id]); + DI::logger()->info('Only public users, quitting', ['target' => $target_id]); return; } @@ -116,7 +115,7 @@ class Notifier $params = ['order' => ['id']]; $items_stmt = Post::select(Item::DELIVER_FIELDLIST, $condition, $params); if (!DBA::isResult($items_stmt)) { - Logger::info('No item found', ['cmd' => $cmd, 'target' => $target_id]); + DI::logger()->info('No item found', ['cmd' => $cmd, 'target' => $target_id]); return; } @@ -132,7 +131,7 @@ class Notifier $owner = User::getOwnerDataById($uid); if (!$owner) { - Logger::info('Owner not found', ['cmd' => $cmd, 'target' => $target_id]); + DI::logger()->info('Owner not found', ['cmd' => $cmd, 'target' => $target_id]); return; } @@ -159,7 +158,7 @@ class Notifier $thr_parent = $parent; } - Logger::info('Got post', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'network' => $target_item['network'], 'parent-network' => $parent['network'], 'thread-parent-network' => $thr_parent['network']]); + DI::logger()->info('Got post', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'network' => $target_item['network'], 'parent-network' => $parent['network'], 'thread-parent-network' => $thr_parent['network']]); // Restrict distribution to AP, when there are no permissions. if (!self::isRemovalActivity($cmd, $owner, Protocol::ACTIVITYPUB) && ($target_item['private'] == Item::PRIVATE) && empty($target_item['allow_cid']) && empty($target_item['allow_gid']) && empty($target_item['deny_cid']) && empty($target_item['deny_gid'])) { @@ -171,7 +170,7 @@ class Notifier if (!$target_item['origin'] && $target_item['network'] == Protocol::ACTIVITYPUB) { $only_ap_delivery = true; $diaspora_delivery = false; - Logger::debug('Remote post arrived via AP', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'network' => $target_item['network'], 'parent-network' => $parent['network'], 'thread-parent-network' => $thr_parent['network']]); + DI::logger()->debug('Remote post arrived via AP', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'network' => $target_item['network'], 'parent-network' => $parent['network'], 'thread-parent-network' => $thr_parent['network']]); } // Only deliver threaded replies (comment to a comment) to Diaspora @@ -179,10 +178,10 @@ class Notifier if ($thr_parent['author-link'] && $target_item['parent-uri'] != $target_item['thr-parent']) { $diaspora_delivery = Diaspora::isSupportedByContactUrl($thr_parent['author-link']); if ($diaspora_delivery && empty($target_item['signed_text'])) { - Logger::debug('Post has got no Diaspora signature, so there will be no Diaspora delivery', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id']]); + DI::logger()->debug('Post has got no Diaspora signature, so there will be no Diaspora delivery', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id']]); $diaspora_delivery = false; } - Logger::info('Threaded comment', ['diaspora_delivery' => (int)$diaspora_delivery]); + DI::logger()->info('Threaded comment', ['diaspora_delivery' => (int)$diaspora_delivery]); } $unlisted = $target_item['private'] == Item::UNLISTED; @@ -215,11 +214,11 @@ class Notifier $exclusive_targets = Tag::getByURIId($parent['uri-id'], [Tag::EXCLUSIVE_MENTION]); if (!empty($exclusive_targets)) { $exclusive_delivery = true; - Logger::info('Possible Exclusively delivering', ['uid' => $target_item['uid'], 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id']]); + DI::logger()->info('Possible Exclusively delivering', ['uid' => $target_item['uid'], 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id']]); foreach ($exclusive_targets as $target) { if (Strings::compareLink($owner['url'], $target['url'])) { $exclusive_delivery = false; - Logger::info('False Exclusively delivering', ['uid' => $target_item['uid'], 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'url' => $target['url']]); + DI::logger()->info('False Exclusively delivering', ['uid' => $target_item['uid'], 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'url' => $target['url']]); } } } @@ -231,7 +230,7 @@ class Notifier $recipients = [$parent['contact-id']]; $recipients_followup = [$parent['contact-id']]; - Logger::info('Followup', ['target' => $target_id, 'guid' => $target_item['guid'], 'to' => $parent['contact-id']]); + DI::logger()->info('Followup', ['target' => $target_id, 'guid' => $target_item['guid'], 'to' => $parent['contact-id']]); } elseif ($exclusive_delivery) { $followup = true; @@ -239,18 +238,18 @@ class Notifier $cid = Contact::getIdForURL($target['url'], $uid, false); if ($cid) { $recipients_followup[] = $cid; - Logger::info('Exclusively delivering', ['uid' => $target_item['uid'], 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'url' => $target['url']]); + DI::logger()->info('Exclusively delivering', ['uid' => $target_item['uid'], 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'url' => $target['url']]); } } } else { $followup = false; - Logger::info('Distributing directly', ['target' => $target_id, 'guid' => $target_item['guid']]); + DI::logger()->info('Distributing directly', ['target' => $target_id, 'guid' => $target_item['guid']]); // don't send deletions onward for other people's stuff if ($target_item['deleted'] && !intval($target_item['wall'])) { - Logger::notice('Ignoring delete notification for non-wall item'); + DI::logger()->notice('Ignoring delete notification for non-wall item'); return; } @@ -305,7 +304,7 @@ class Notifier if ($diaspora_delivery) { $networks = [Protocol::DFRN, Protocol::DIASPORA, Protocol::MAIL]; if (($parent['network'] == Protocol::DIASPORA) || ($thr_parent['network'] == Protocol::DIASPORA)) { - Logger::info('Add AP contacts', ['target' => $target_id, 'guid' => $target_item['guid']]); + DI::logger()->info('Add AP contacts', ['target' => $target_id, 'guid' => $target_item['guid']]); $networks[] = Protocol::ACTIVITYPUB; } } else { @@ -375,7 +374,7 @@ class Notifier } if (!empty($target_item)) { - Logger::info('Calling hooks for ' . $cmd . ' ' . $target_id); + DI::logger()->info('Calling hooks for ' . $cmd . ' ' . $target_id); Hook::fork($appHelper->getQueueValue('priority'), 'notifier_normal', $target_item); @@ -420,7 +419,7 @@ class Notifier $delivery_queue_count = 0; if (!empty($target_item['verb']) && ($target_item['verb'] == Activity::ANNOUNCE)) { - Logger::notice('Announces are only delivery via ActivityPub', ['cmd' => $cmd, 'id' => $target_item['id'], 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); + DI::logger()->notice('Announces are only delivery via ActivityPub', ['cmd' => $cmd, 'id' => $target_item['id'], 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); return 0; } @@ -428,40 +427,40 @@ class Notifier // Transmit via Diaspora if the thread had started as Diaspora post. // Also transmit via Diaspora if this is a direct answer to a Diaspora comment. if (($contact['network'] != Protocol::DIASPORA) && in_array(Protocol::DIASPORA, [$parent['network'] ?? '', $thr_parent['network'] ?? '', $target_item['network'] ?? ''])) { - Logger::info('Enforcing the Diaspora protocol', ['id' => $contact['id'], 'network' => $contact['network'], 'parent' => $parent['network'], 'thread-parent' => $thr_parent['network'], 'post' => $target_item['network']]); + DI::logger()->info('Enforcing the Diaspora protocol', ['id' => $contact['id'], 'network' => $contact['network'], 'parent' => $parent['network'], 'thread-parent' => $thr_parent['network'], 'post' => $target_item['network']]); $contact['network'] = Protocol::DIASPORA; } // Direct delivery of local contacts if (!in_array($cmd, [Delivery::RELOCATION, Delivery::SUGGESTION, Delivery::MAIL]) && $target_uid = User::getIdForURL($contact['url'])) { if ($cmd == Delivery::DELETION) { - Logger::info('No need to deliver deletions internally', ['uid' => $target_uid, 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); + DI::logger()->info('No need to deliver deletions internally', ['uid' => $target_uid, 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); continue; } if ($target_item['origin'] || ($target_item['network'] != Protocol::ACTIVITYPUB)) { if ($target_uid != $target_item['uid']) { $fields = ['protocol' => Conversation::PARCEL_LOCAL_DFRN, 'direction' => Conversation::PUSH, 'post-reason' => Item::PR_DIRECT]; Item::storeForUserByUriId($target_item['uri-id'], $target_uid, $fields, $target_item['uid']); - Logger::info('Delivered locally', ['cmd' => $cmd, 'id' => $target_item['id'], 'target' => $target_uid]); + DI::logger()->info('Delivered locally', ['cmd' => $cmd, 'id' => $target_item['id'], 'target' => $target_uid]); } else { - Logger::info('No need to deliver to myself', ['uid' => $target_uid, 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); + DI::logger()->info('No need to deliver to myself', ['uid' => $target_uid, 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); } } else { - Logger::info('Remote item does not need to be delivered locally', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); + DI::logger()->info('Remote item does not need to be delivered locally', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); } continue; } $cdata = Contact::getPublicAndUserContactID($contact['id'], $sender_uid); if (empty($cdata)) { - Logger::info('No contact entry found', ['id' => $contact['id'], 'uid' => $sender_uid]); + DI::logger()->info('No contact entry found', ['id' => $contact['id'], 'uid' => $sender_uid]); continue; } 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']]); + DI::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; } elseif (in_array($cdata['user'] ?: $contact['id'], $ap_contacts)) { - Logger::info('The user 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']]); + DI::logger()->info('The user 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; } @@ -469,29 +468,29 @@ class Notifier // We mark the contact here, since we could have only got here, when the "archived" value on this // specific contact hadn't been set. Contact::markForArchival($contact); - Logger::info('Contact is archived, so skip delivery', ['target' => $post_uriid, 'uid' => $sender_uid, 'contact' => $contact['url']]); + DI::logger()->info('Contact is archived, so skip delivery', ['target' => $post_uriid, 'uid' => $sender_uid, 'contact' => $contact['url']]); continue; } if (self::isRemovalActivity($cmd, $owner, $contact['network'])) { - Logger::info('Contact does no supports account removal commands, so skip delivery', ['target' => $post_uriid, 'uid' => $sender_uid, 'contact' => $contact['url']]); + DI::logger()->info('Contact does no supports account removal commands, so skip delivery', ['target' => $post_uriid, 'uid' => $sender_uid, 'contact' => $contact['url']]); continue; } if (self::skipActivityPubForDiaspora($contact, $target_item, $thr_parent)) { - Logger::info('Contact is from Diaspora, but the replied author is from ActivityPub, so skip delivery via Diaspora', ['id' => $post_uriid, 'uid' => $sender_uid, 'url' => $contact['url']]); + DI::logger()->info('Contact is from Diaspora, but the replied author is from ActivityPub, so skip delivery via Diaspora', ['id' => $post_uriid, 'uid' => $sender_uid, 'url' => $contact['url']]); continue; } // Don't deliver to Diaspora if it already had been done as batch delivery if (!$in_batch && $batch_delivery && ($contact['network'] == Protocol::DIASPORA)) { - Logger::info('Diaspora contact is already delivered via batch', ['id' => $post_uriid, 'uid' => $sender_uid, 'contact' => $contact]); + DI::logger()->info('Diaspora contact is already delivered via batch', ['id' => $post_uriid, 'uid' => $sender_uid, 'contact' => $contact]); continue; } // Don't deliver to folks who have already been delivered to if (in_array($contact['id'], $conversants)) { - Logger::info('Already delivery', ['id' => $post_uriid, 'uid' => $sender_uid, 'contact' => $contact]); + DI::logger()->info('Already delivery', ['id' => $post_uriid, 'uid' => $sender_uid, 'contact' => $contact]); continue; } @@ -504,16 +503,16 @@ class Notifier } if (!$reachable) { - Logger::info('Server is not reachable', ['id' => $post_uriid, 'uid' => $sender_uid, 'contact' => $contact]); + DI::logger()->info('Server is not reachable', ['id' => $post_uriid, 'uid' => $sender_uid, 'contact' => $contact]); continue; } if (($contact['network'] == Protocol::ACTIVITYPUB) && !DI::dsprContact()->existsByUriId($contact['uri-id'])) { - Logger::info('The ActivityPub contact does not support Diaspora, so skip delivery via Diaspora', ['id' => $post_uriid, 'uid' => $sender_uid, 'url' => $contact['url']]); + DI::logger()->info('The ActivityPub contact does not support Diaspora, so skip delivery via Diaspora', ['id' => $post_uriid, 'uid' => $sender_uid, 'url' => $contact['url']]); continue; } - Logger::info('Delivery', ['cmd' => $cmd, 'batch' => $in_batch, 'target' => $post_uriid, 'uid' => $sender_uid, 'guid' => $target_item['guid'] ?? '', 'to' => $contact]); + DI::logger()->info('Delivery', ['cmd' => $cmd, 'batch' => $in_batch, 'target' => $post_uriid, 'uid' => $sender_uid, 'guid' => $target_item['guid'] ?? '', 'to' => $contact]); // Ensure that posts with our own protocol arrives before Diaspora posts arrive. // Situation is that sometimes Friendica servers receive Friendica posts over the Diaspora protocol first. @@ -617,7 +616,7 @@ class Notifier $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($self_user_id); foreach ($inboxes as $inbox => $receivers) { - Logger::info('Account removal via ActivityPub', ['uid' => $self_user_id, 'inbox' => $inbox]); + DI::logger()->info('Account removal via ActivityPub', ['uid' => $self_user_id, 'inbox' => $inbox]); Worker::add(['priority' => Worker::PRIORITY_NEGLIGIBLE, 'created' => $created, 'dont_fork' => true], 'APDelivery', Delivery::REMOVAL, 0, $inbox, $self_user_id, $receivers); Worker::coolDown(); @@ -644,25 +643,25 @@ class Notifier { // Don't deliver via AP when the starting post isn't from a federated network if (!in_array($parent['network'] ?? '', Protocol::FEDERATED)) { - Logger::info('Parent network is no federated network, so no AP delivery', ['network' => $parent['network'] ?? '']); + DI::logger()->info('Parent network is no federated network, so no AP delivery', ['network' => $parent['network'] ?? '']); return ['count' => 0, 'contacts' => []]; } // Don't deliver via AP when the starting post is delivered via Diaspora if ($parent['network'] == Protocol::DIASPORA) { - Logger::info('Parent network is Diaspora, so no AP delivery'); + DI::logger()->info('Parent network is Diaspora, so no AP delivery'); return ['count' => 0, 'contacts' => []]; } // Also don't deliver when the direct thread parent was delivered via Diaspora if ($thr_parent['network'] == Protocol::DIASPORA) { - Logger::info('Thread parent network is Diaspora, so no AP delivery'); + DI::logger()->info('Thread parent network is Diaspora, so no AP delivery'); return ['count' => 0, 'contacts' => []]; } // Posts from Diaspora contacts are transmitted via Diaspora if ($target_item['network'] == Protocol::DIASPORA) { - Logger::info('Post network is Diaspora, so no AP delivery'); + DI::logger()->info('Post network is Diaspora, so no AP delivery'); return ['count' => 0, 'contacts' => []]; } @@ -687,10 +686,10 @@ class Notifier $relay_inboxes = ActivityPub\Transmitter::addRelayServerInboxes(); } - Logger::info('Origin item will be distributed', ['id' => $target_item['id'], 'url' => $target_item['uri'], 'verb' => $target_item['verb']]); + DI::logger()->info('Origin item will be distributed', ['id' => $target_item['id'], 'url' => $target_item['uri'], 'verb' => $target_item['verb']]); $check_signature = false; } elseif (!$target_item['deleted'] && !Post\Activity::exists($target_item['uri-id'])) { - Logger::info('Remote activity not found. It will not be distributed.', ['id' => $target_item['id'], 'url' => $target_item['uri'], 'verb' => $target_item['verb']]); + DI::logger()->info('Remote activity not found. It will not be distributed.', ['id' => $target_item['id'], 'url' => $target_item['uri'], 'verb' => $target_item['verb']]); return ['count' => 0, 'contacts' => []]; } elseif ($parent['origin'] && ($target_item['private'] != Item::PRIVATE) && (($target_item['gravity'] != Item::GRAVITY_ACTIVITY) || DI::config()->get('system', 'redistribute_activities'))) { $inboxes = ActivityPub\Transmitter::fetchTargetInboxes($parent, $uid); @@ -699,10 +698,10 @@ class Notifier $inboxes = ActivityPub\Transmitter::addRelayServerInboxesForItem($parent['id'], $inboxes); } - Logger::info('Remote item will be distributed', ['id' => $target_item['id'], 'url' => $target_item['uri'], 'verb' => $target_item['verb']]); + DI::logger()->info('Remote item will be distributed', ['id' => $target_item['id'], 'url' => $target_item['uri'], 'verb' => $target_item['verb']]); $check_signature = ($target_item['gravity'] == Item::GRAVITY_ACTIVITY); } else { - Logger::info('Remote activity will not be distributed', ['id' => $target_item['id'], 'url' => $target_item['uri'], 'verb' => $target_item['verb']]); + DI::logger()->info('Remote activity will not be distributed', ['id' => $target_item['id'], 'url' => $target_item['uri'], 'verb' => $target_item['verb']]); return ['count' => 0, 'contacts' => []]; } @@ -711,19 +710,19 @@ class Notifier } if (empty($inboxes) && empty($relay_inboxes)) { - Logger::info('No inboxes found for item ' . $target_item['id'] . ' with URL ' . $target_item['uri'] . '. It will not be distributed.'); + DI::logger()->info('No inboxes found for item ' . $target_item['id'] . ' with URL ' . $target_item['uri'] . '. It will not be distributed.'); return ['count' => 0, 'contacts' => []]; } // Fill the item cache $activity = ActivityPub\Transmitter::createCachedActivityFromItem($target_item['id'], true); if (empty($activity)) { - Logger::info('Item cache was not created. The post will not be distributed.', ['id' => $target_item['id'], 'url' => $target_item['uri'], 'verb' => $target_item['verb']]); + DI::logger()->info('Item cache was not created. The post will not be distributed.', ['id' => $target_item['id'], 'url' => $target_item['uri'], 'verb' => $target_item['verb']]); return ['count' => 0, 'contacts' => []]; } if ($check_signature && !LDSignature::isSigned($activity)) { - Logger::info('Unsigned remote activity will not be distributed', ['id' => $target_item['id'], 'url' => $target_item['uri'], 'verb' => $target_item['verb']]); + DI::logger()->info('Unsigned remote activity will not be distributed', ['id' => $target_item['id'], 'url' => $target_item['uri'], 'verb' => $target_item['verb']]); return ['count' => 0, 'contacts' => []]; } @@ -737,27 +736,27 @@ class Notifier $contact = Contact::getById($receivers[0], ['url']); if (!in_array($cmd, [Delivery::RELOCATION, Delivery::SUGGESTION, Delivery::MAIL]) && ($target_uid = User::getIdForURL($contact['url']))) { if ($cmd == Delivery::DELETION) { - Logger::info('No need to deliver deletions internally', ['uid' => $target_uid, 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); + DI::logger()->info('No need to deliver deletions internally', ['uid' => $target_uid, 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); continue; } if ($target_item['origin'] || ($target_item['network'] != Protocol::ACTIVITYPUB)) { if ($target_uid != $target_item['uid']) { $fields = ['protocol' => Conversation::PARCEL_LOCAL_DFRN, 'direction' => Conversation::PUSH, 'post-reason' => Item::PR_BCC]; Item::storeForUserByUriId($target_item['uri-id'], $target_uid, $fields, $target_item['uid']); - Logger::info('Delivered locally', ['cmd' => $cmd, 'id' => $target_item['id'], 'inbox' => $inbox]); + DI::logger()->info('Delivered locally', ['cmd' => $cmd, 'id' => $target_item['id'], 'inbox' => $inbox]); } else { - Logger::info('No need to deliver to myself', ['uid' => $target_uid, 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); + DI::logger()->info('No need to deliver to myself', ['uid' => $target_uid, 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); } } else { - Logger::info('Remote item does not need to be delivered locally', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); + DI::logger()->info('Remote item does not need to be delivered locally', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); } continue; } } elseif ((count($receivers) >= 1) && DI::baseUrl()->isLocalUrl($inbox)) { - Logger::info('Is this a thing?', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); + DI::logger()->info('Is this a thing?', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]); } - Logger::info('Delivery via ActivityPub', ['cmd' => $cmd, 'id' => $target_item['id'], 'inbox' => $inbox]); + DI::logger()->info('Delivery via ActivityPub', ['cmd' => $cmd, 'id' => $target_item['id'], 'inbox' => $inbox]); if (DI::config()->get('system', 'bulk_delivery')) { $delivery_queue_count++; @@ -774,7 +773,7 @@ class Notifier // We deliver posts to relay servers slightly delayed to prioritize the direct delivery foreach ($relay_inboxes as $inbox) { - Logger::info('Delivery to relay servers via ActivityPub', ['cmd' => $cmd, 'id' => $target_item['id'], 'inbox' => $inbox]); + DI::logger()->info('Delivery to relay servers via ActivityPub', ['cmd' => $cmd, 'id' => $target_item['id'], 'inbox' => $inbox]); if (DI::config()->get('system', 'bulk_delivery')) { $delivery_queue_count++;