Replace Logger with $this->logger in Module ActivityPub classes

This commit is contained in:
Art4 2025-01-13 11:41:58 +00:00
parent 8643231019
commit c9588fcbb0
2 changed files with 5 additions and 8 deletions

View file

@ -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'])) {

View file

@ -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();
}
}