mirror of
https://github.com/friendica/friendica
synced 2025-05-08 19:44:10 +02:00
Replace Logger with DI::logger() in many Worker classes
This commit is contained in:
parent
1762d1e72d
commit
8fe3383976
19 changed files with 70 additions and 83 deletions
|
@ -9,7 +9,6 @@ namespace Friendica\Worker;
|
|||
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\Plaintext;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Factory\Api\Mastodon\Notification as NotificationFactory;
|
||||
|
@ -32,30 +31,30 @@ class PushSubscription
|
|||
*/
|
||||
public static function execute(int $sid, int $nid)
|
||||
{
|
||||
Logger::info('Start', ['subscription' => $sid, 'notification' => $nid]);
|
||||
DI::logger()->info('Start', ['subscription' => $sid, 'notification' => $nid]);
|
||||
|
||||
$subscription = DBA::selectFirst('subscription', [], ['id' => $sid]);
|
||||
if (empty($subscription)) {
|
||||
Logger::info('Subscription not found', ['subscription' => $sid]);
|
||||
DI::logger()->info('Subscription not found', ['subscription' => $sid]);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$notification = DI::notification()->selectOneById($nid);
|
||||
} catch (NotFoundException $e) {
|
||||
Logger::info('Notification not found', ['notification' => $nid]);
|
||||
DI::logger()->info('Notification not found', ['notification' => $nid]);
|
||||
return;
|
||||
}
|
||||
|
||||
$application_token = DBA::selectFirst('application-token', [], ['application-id' => $subscription['application-id'], 'uid' => $subscription['uid']]);
|
||||
if (empty($application_token)) {
|
||||
Logger::info('Application token not found', ['application' => $subscription['application-id']]);
|
||||
DI::logger()->info('Application token not found', ['application' => $subscription['application-id']]);
|
||||
return;
|
||||
}
|
||||
|
||||
$user = User::getById($notification->uid);
|
||||
if (empty($user)) {
|
||||
Logger::info('User not found', ['application' => $subscription['uid']]);
|
||||
DI::logger()->info('User not found', ['application' => $subscription['uid']]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -97,7 +96,7 @@ class PushSubscription
|
|||
'body' => $body ?: $l10n->t('Empty Post'),
|
||||
];
|
||||
|
||||
Logger::info('Payload', ['payload' => $payload]);
|
||||
DI::logger()->info('Payload', ['payload' => $payload]);
|
||||
|
||||
$auth = [
|
||||
'VAPID' => [
|
||||
|
@ -114,9 +113,9 @@ class PushSubscription
|
|||
$endpoint = $report->getRequest()->getUri()->__toString();
|
||||
|
||||
if ($report->isSuccess()) {
|
||||
Logger::info('Message sent successfully for subscription', ['subscription' => $sid, 'notification' => $nid, 'endpoint' => $endpoint]);
|
||||
DI::logger()->info('Message sent successfully for subscription', ['subscription' => $sid, 'notification' => $nid, 'endpoint' => $endpoint]);
|
||||
} else {
|
||||
Logger::info('Message failed to sent for subscription', ['subscription' => $sid, 'notification' => $nid, 'endpoint' => $endpoint, 'reason' => $report->getReason()]);
|
||||
DI::logger()->info('Message failed to sent for subscription', ['subscription' => $sid, 'notification' => $nid, 'endpoint' => $endpoint, 'reason' => $report->getReason()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue