From c9588fcbb07f34db8ea804068b52c493a2da1c24 Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 13 Jan 2025 11:41:58 +0000 Subject: [PATCH] Replace Logger with $this->logger in Module ActivityPub classes --- src/Module/ActivityPub/Inbox.php | 5 ++--- src/Module/ActivityPub/Objects.php | 8 +++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Module/ActivityPub/Inbox.php b/src/Module/ActivityPub/Inbox.php index 23715ceb21..f654b3853b 100644 --- a/src/Module/ActivityPub/Inbox.php +++ b/src/Module/ActivityPub/Inbox.php @@ -7,7 +7,6 @@ namespace Friendica\Module\ActivityPub; -use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Core\System; use Friendica\Database\DBA; @@ -66,7 +65,7 @@ class Inbox extends BaseApi } if (!HTTPSignature::isValidContentType($this->server['CONTENT_TYPE'] ?? '')) { - Logger::notice('Unexpected content type', ['content-type' => $this->server['CONTENT_TYPE'] ?? '', 'agent' => $this->server['HTTP_USER_AGENT'] ?? '']); + $this->logger->notice('Unexpected content type', ['content-type' => $this->server['CONTENT_TYPE'] ?? '', 'agent' => $this->server['HTTP_USER_AGENT'] ?? '']); throw new \Friendica\Network\HTTPException\UnsupportedMediaTypeException(); } @@ -78,7 +77,7 @@ class Inbox extends BaseApi } $tempfile = tempnam(System::getTempPath(), $filename); file_put_contents($tempfile, json_encode(['parameters' => $this->parameters, 'header' => $_SERVER, 'body' => $postdata], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)); - Logger::notice('Incoming message stored', ['file' => $tempfile]); + $this->logger->notice('Incoming message stored', ['file' => $tempfile]); } if (!empty($this->parameters['nickname'])) { diff --git a/src/Module/ActivityPub/Objects.php b/src/Module/ActivityPub/Objects.php index 9b72a52cee..1fa7b2fec5 100644 --- a/src/Module/ActivityPub/Objects.php +++ b/src/Module/ActivityPub/Objects.php @@ -8,8 +8,6 @@ namespace Friendica\Module\ActivityPub; use Friendica\BaseModule; -use Friendica\Core\Logger; -use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; @@ -39,7 +37,7 @@ class Objects extends BaseModule $itemuri = DBA::selectFirst('item-uri', ['id'], ['guid' => $this->parameters['guid']]); if (DBA::isResult($itemuri)) { - Logger::info('Provided GUID found.', ['guid' => $this->parameters['guid'], 'uri-id' => $itemuri['id']]); + $this->logger->info('Provided GUID found.', ['guid' => $this->parameters['guid'], 'uri-id' => $itemuri['id']]); } else { // The item URI does not always contain the GUID. This means that we have to search the URL instead $url = DI::baseUrl() . '/' . DI::args()->getQueryString(); @@ -48,9 +46,9 @@ class Objects extends BaseModule $itemuri = DBA::selectFirst('item-uri', ['guid', 'id'], ['uri' => [$url, $nurl, $ssl_url]]); if (DBA::isResult($itemuri)) { - Logger::info('URL found.', ['url' => $url, 'guid' => $itemuri['guid'], 'uri-id' => $itemuri['id']]); + $this->logger->info('URL found.', ['url' => $url, 'guid' => $itemuri['guid'], 'uri-id' => $itemuri['id']]); } else { - Logger::info('URL not found.', ['url' => $url]); + $this->logger->info('URL not found.', ['url' => $url]); throw new HTTPException\NotFoundException(); } }