]> git.mxchange.org Git - friendica.git/commitdiff
Replace Logger with DI::logger() in many Worker classes
authorArt4 <art4@wlabs.de>
Mon, 13 Jan 2025 13:19:24 +0000 (13:19 +0000)
committerArt4 <art4@wlabs.de>
Mon, 13 Jan 2025 13:19:24 +0000 (13:19 +0000)
19 files changed:
src/Worker/APDelivery.php
src/Worker/BulkDelivery.php
src/Worker/CheckRelMeProfileLink.php
src/Worker/CheckVersion.php
src/Worker/Cron.php
src/Worker/DelayedPublish.php
src/Worker/Directory.php
src/Worker/FetchFeaturedPosts.php
src/Worker/FetchMissingActivity.php
src/Worker/MergeContact.php
src/Worker/NodeInfo.php
src/Worker/OptimizeTables.php
src/Worker/PollContacts.php
src/Worker/ProfileUpdate.php
src/Worker/PullDirectory.php
src/Worker/PushSubscription.php
src/Worker/SearchDirectory.php
src/Worker/SetSeen.php
src/Worker/SpoolPost.php

index a3966de8c43551b3e37b4a1f2541bca37903d313..2d1df8cca4b021c35a761863ca2c718b3a5739d2 100644 (file)
@@ -7,8 +7,8 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
 use Friendica\Core\Worker;
+use Friendica\DI;
 use Friendica\Model\Post;
 use Friendica\Model\User;
 use Friendica\Protocol\ActivityPub;
@@ -29,7 +29,7 @@ class APDelivery
        public static function execute(string $cmd, int $item_id, string $inbox, int $uid, array $receivers = [], int $uri_id = 0)
        {
                if (ActivityPub\Transmitter::archivedInbox($inbox)) {
-                       Logger::info('Inbox is archived', ['cmd' => $cmd, 'inbox' => $inbox, 'id' => $item_id, 'uri-id' => $uri_id, 'uid' => $uid]);
+                       DI::logger()->info('Inbox is archived', ['cmd' => $cmd, 'inbox' => $inbox, 'id' => $item_id, 'uri-id' => $uri_id, 'uid' => $uid]);
                        if (empty($uri_id) && !empty($item_id)) {
                                $item = Post::selectFirst(['uri-id'], ['id' => $item_id]);
                                $uri_id = $item['uri-id'] ?? 0;
@@ -48,7 +48,7 @@ class APDelivery
                        return;
                }
 
-               Logger::debug('Invoked', ['cmd' => $cmd, 'inbox' => $inbox, 'id' => $item_id, 'uri-id' => $uri_id, 'uid' => $uid]);
+               DI::logger()->debug('Invoked', ['cmd' => $cmd, 'inbox' => $inbox, 'id' => $item_id, 'uri-id' => $uri_id, 'uid' => $uid]);
 
                if (empty($uri_id)) {
                        $result  = ActivityPub\Delivery::deliver($inbox);
index 269a04fa58296d9893b222028e9069bbfa44911a..3d42424a8272846ca6fde669a17f80486cd0e594 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
 use Friendica\Core\Worker;
 use Friendica\DI;
 use Friendica\Model\GServer;
@@ -24,7 +23,7 @@ class BulkDelivery
                foreach ($deliveryQueueItems as $deliveryQueueItem) {
                        if (!$server_failure && ProtocolDelivery::deliver($deliveryQueueItem->command, $deliveryQueueItem->postUriId, $deliveryQueueItem->targetContactId, $deliveryQueueItem->senderUserId)) {
                                DI::deliveryQueueItemRepo()->remove($deliveryQueueItem);
-                               Logger::debug('Delivery successful', $deliveryQueueItem->toArray());
+                               DI::logger()->debug('Delivery successful', $deliveryQueueItem->toArray());
                        } else {
                                DI::deliveryQueueItemRepo()->incrementFailed($deliveryQueueItem);
                                $delivery_failure = true;
@@ -32,7 +31,7 @@ class BulkDelivery
                                if (!$server_failure) {
                                        $server_failure = !GServer::isReachableById($gsid);
                                }
-                               Logger::debug('Delivery failed', ['server_failure' => $server_failure, 'post' => $deliveryQueueItem]);
+                               DI::logger()->debug('Delivery failed', ['server_failure' => $server_failure, 'post' => $deliveryQueueItem]);
                        }
                }
 
index 0aeaf49c2ccee0107adea0599683c47d216d8905..3b0f1800e3ae81ca763b60c93994db4efae32307 100644 (file)
@@ -9,7 +9,6 @@ namespace Friendica\Worker;
 
 use DOMDocument;
 use Friendica\Content\Text\HTML;
-use Friendica\Core\Logger;
 use Friendica\DI;
 use Friendica\Model\Profile;
 use Friendica\Model\User;
@@ -41,12 +40,12 @@ class CheckRelMeProfileLink
         */
        public static function execute(int $uid)
        {
-               Logger::notice('Verifying the homepage', ['uid' => $uid]);
+               DI::logger()->notice('Verifying the homepage', ['uid' => $uid]);
                Profile::update(['homepage_verified' => false], $uid);
 
                $owner = User::getOwnerDataById($uid);
                if (empty($owner['homepage'])) {
-                       Logger::notice('The user has no homepage link.', ['uid' => $uid]);
+                       DI::logger()->notice('The user has no homepage link.', ['uid' => $uid]);
                        return;
                }
 
@@ -54,31 +53,31 @@ class CheckRelMeProfileLink
                try {
                        $curlResult = DI::httpClient()->get($owner['homepage'], HttpClientAccept::HTML, [HttpClientOptions::TIMEOUT => $xrd_timeout, HttpClientOptions::REQUEST => HttpClientRequest::CONTACTVERIFIER]);
                } catch (\Throwable $th) {
-                       Logger::notice('Got exception', ['code' => $th->getCode(), 'message' => $th->getMessage()]);
+                       DI::logger()->notice('Got exception', ['code' => $th->getCode(), 'message' => $th->getMessage()]);
                        return;
                }
                if (!$curlResult->isSuccess()) {
-                       Logger::notice('Could not cURL the homepage URL', ['owner homepage' => $owner['homepage']]);
+                       DI::logger()->notice('Could not cURL the homepage URL', ['owner homepage' => $owner['homepage']]);
                        return;
                }
 
                $content = $curlResult->getBodyString();
                if (!$content) {
-                       Logger::notice('Empty body of the fetched homepage link). Cannot verify the relation to profile of UID %s.', ['uid' => $uid, 'owner homepage' => $owner['homepage']]);
+                       DI::logger()->notice('Empty body of the fetched homepage link). Cannot verify the relation to profile of UID %s.', ['uid' => $uid, 'owner homepage' => $owner['homepage']]);
                        return;
                }
 
                $doc = new DOMDocument();
                if (!@$doc->loadHTML($content)) {
-                       Logger::notice('Could not parse the content');
+                       DI::logger()->notice('Could not parse the content');
                        return;
                }
 
                if (HTML::checkRelMeLink($doc, new Uri($owner['url']))) {
                        Profile::update(['homepage_verified' => true], $uid);
-                       Logger::notice('Homepage URL verified', ['uid' => $uid, 'owner homepage' => $owner['homepage']]);
+                       DI::logger()->notice('Homepage URL verified', ['uid' => $uid, 'owner homepage' => $owner['homepage']]);
                } else {
-                       Logger::notice('Homepage URL could not be verified', ['uid' => $uid, 'owner homepage' => $owner['homepage']]);
+                       DI::logger()->notice('Homepage URL could not be verified', ['uid' => $uid, 'owner homepage' => $owner['homepage']]);
                }
        }
 }
index c62cc5f18290faef0f64e1c523a2a188091363c2..2a8f7264aebcd3af261488f842b317e336e9137b 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Network\HTTPClient\Client\HttpClientAccept;
@@ -22,7 +21,7 @@ class CheckVersion
 {
        public static function execute()
        {
-               Logger::notice('checkversion: start');
+               DI::logger()->notice('checkversion: start');
 
                $checkurl = DI::config()->get('system', 'check_new_version_url', 'none');
 
@@ -38,15 +37,15 @@ class CheckVersion
                                // don't check
                                return;
                }
-               Logger::info("Checking VERSION from: ".$checked_url);
+               DI::logger()->info("Checking VERSION from: ".$checked_url);
 
                // fetch the VERSION file
                $gitversion = DBA::escape(trim(DI::httpClient()->fetch($checked_url, HttpClientAccept::TEXT)));
-               Logger::notice("Upstream VERSION is: ".$gitversion);
+               DI::logger()->notice("Upstream VERSION is: ".$gitversion);
 
                DI::keyValue()->set('git_friendica_version', $gitversion);
 
-               Logger::notice('checkversion: end');
+               DI::logger()->notice('checkversion: end');
 
                return;
        }
index c10a548559a6cf7f52f65aaedea4768000aa501d..3438b9e55a084cc5b845f8e141bf318696304b55 100644 (file)
@@ -9,7 +9,6 @@ namespace Friendica\Worker;
 
 use Friendica\Core\Addon;
 use Friendica\Core\Hook;
-use Friendica\Core\Logger;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
 use Friendica\DI;
@@ -30,12 +29,12 @@ class Cron
                if ($last) {
                        $next = $last + ($poll_interval * 60);
                        if ($next > time()) {
-                               Logger::notice('cron interval not reached');
+                               DI::logger()->notice('cron interval not reached');
                                return;
                        }
                }
 
-               Logger::notice('start');
+               DI::logger()->notice('start');
 
                // Ensure to have a .htaccess file.
                // this is a precaution for systems that update automatically
@@ -151,7 +150,7 @@ class Cron
                        DI::keyValue()->set('last_cron_daily', time());
                }
 
-               Logger::notice('end');
+               DI::logger()->notice('end');
 
                DI::keyValue()->set('last_cron', time());
        }
@@ -163,7 +162,7 @@ class Cron
         */
        private static function deleteSleepingProcesses()
        {
-               Logger::info('Looking for sleeping processes');
+               DI::logger()->info('Looking for sleeping processes');
 
                DBA::deleteSleepingProcesses();
        }
index a484ddbc6a2b61743fb386a2e3bd38b6131365e4..8020a042d4160072ee70456c6279aab87ae97e63 100644 (file)
@@ -7,7 +7,7 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
+use Friendica\DI;
 use Friendica\Model\Post;
 
 class DelayedPublish
@@ -26,6 +26,6 @@ class DelayedPublish
        public static function execute(array $item, int $notify = 0, array $taglist = [], array $attachments = [], int $preparation_mode = Post\Delayed::PREPARED, string $uri = '')
        {
                $id = Post\Delayed::publish($item, $notify, $taglist, $attachments, $preparation_mode, $uri);
-               Logger::notice('Post published', ['id' => $id, 'uid' => $item['uid'], 'notify' => $notify, 'unprepared' => $preparation_mode]);
+               DI::logger()->notice('Post published', ['id' => $id, 'uid' => $item['uid'], 'notify' => $notify, 'unprepared' => $preparation_mode]);
        }
 }
index b5025d77109378152dd9a5a807702f2edb5fa1af..e9a91022774c2d0546c906f6dbd3e918a9def107 100644 (file)
@@ -8,7 +8,6 @@
 namespace Friendica\Worker;
 
 use Friendica\Core\Hook;
-use Friendica\Core\Logger;
 use Friendica\Core\Search;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
@@ -40,7 +39,7 @@ class Directory
 
                Hook::callAll('globaldir_update', $arr);
 
-               Logger::info('Updating directory: ' . $arr['url']);
+               DI::logger()->info('Updating directory: ' . $arr['url']);
                if (strlen($arr['url'])) {
                        DI::httpClient()->fetch($dir . '?url=' . bin2hex($arr['url']), HttpClientAccept::HTML, 0, '', HttpClientRequest::CONTACTDISCOVER);
                }
index de8bc96b9a43251979c9119aef85c0a1ec1a5b6c..be314decb7e037cf1bfe6663e84b26c27f7f2681 100644 (file)
@@ -7,7 +7,7 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
+use Friendica\DI;
 use Friendica\Protocol\ActivityPub;
 
 class FetchFeaturedPosts
@@ -18,8 +18,8 @@ class FetchFeaturedPosts
         */
        public static function execute(string $url)
        {
-               Logger::info('Start fetching featured posts', ['url' => $url]);
+               DI::logger()->info('Start fetching featured posts', ['url' => $url]);
                ActivityPub\Processor::fetchFeaturedPosts($url);
-               Logger::info('Finished fetching featured posts', ['url' => $url]);
+               DI::logger()->info('Finished fetching featured posts', ['url' => $url]);
        }
 }
index 5b6e8ffd03f5cb62795df64a1a2c775ad03b69c7..4cbc47976dd09e56ec8516490f242c6640d45e95 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
 use Friendica\Core\Worker;
 use Friendica\DI;
 use Friendica\Protocol\ActivityPub;
@@ -26,18 +25,18 @@ class FetchMissingActivity
         */
        public static function execute(string $url, array $child = [], string $relay_actor = '', int $completion = Receiver::COMPLETION_MANUAL)
        {
-               Logger::info('Start fetching missing activity', ['url' => $url]);
+               DI::logger()->info('Start fetching missing activity', ['url' => $url]);
                if (ActivityPub\Processor::alreadyKnown($url, $child['id'] ?? '')) {
-                       Logger::info('Activity is already known.', ['url' => $url]);
+                       DI::logger()->info('Activity is already known.', ['url' => $url]);
                        return;
                }
                $result = ActivityPub\Processor::fetchMissingActivity($url, $child, $relay_actor, $completion);
                if ($result) {
-                       Logger::info('Successfully fetched missing activity', ['url' => $url]);
+                       DI::logger()->info('Successfully fetched missing activity', ['url' => $url]);
                } elseif (is_null($result)) {
-                       Logger::info('Permament error, activity could not be fetched', ['url' => $url]);
+                       DI::logger()->info('Permament error, activity could not be fetched', ['url' => $url]);
                } elseif (!Worker::defer(self::WORKER_DEFER_LIMIT)) {
-                       Logger::info('Defer limit reached, activity could not be fetched', ['url' => $url]);
+                       DI::logger()->info('Defer limit reached, activity could not be fetched', ['url' => $url]);
 
                        // recursively delete all entries that belong to this worker task
                        $queue = DI::appHelper()->getQueue();
@@ -45,7 +44,7 @@ class FetchMissingActivity
                                Queue::deleteByWorkerId($queue['id']);
                        }
                } else {
-                       Logger::info('Fetching deferred', ['url' => $url]);
+                       DI::logger()->info('Fetching deferred', ['url' => $url]);
                }
        }
 }
index 5c32f80fec5f475bafeab1cbeb0c695ecd0c6333..cdb464211b8237117a45186526b96cd6dbc0fd38 100644 (file)
@@ -7,9 +7,9 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
 use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
+use Friendica\DI;
 use Friendica\Model\Contact;
 
 class MergeContact
@@ -28,7 +28,7 @@ class MergeContact
                        return;
                }
 
-               Logger::info('Handling duplicate', ['search' => $old_cid, 'replace' => $new_cid]);
+               DI::logger()->info('Handling duplicate', ['search' => $old_cid, 'replace' => $new_cid]);
 
                foreach (['item', 'thread', 'post-user', 'post-thread-user'] as $table) {
                        if (DBStructure::existsTable($table)) {
index 89fca9a1b3ea87f69b4e836e742b20f19607d07b..363d2ce1f9c448c713694edde02d172472e32289 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
 use Friendica\DI;
 use Friendica\Model\Nodeinfo as ModelNodeInfo;
 use Friendica\Network\HTTPClient\Client\HttpClientAccept;
@@ -16,13 +15,13 @@ class NodeInfo
 {
        public static function execute()
        {
-               Logger::info('start');
+               DI::logger()->info('start');
                ModelNodeInfo::update();
                // Now trying to register
                $url = 'http://the-federation.info/register/' . DI::baseUrl()->getHost();
-               Logger::debug('Check registering url', ['url' => $url]);
+               DI::logger()->debug('Check registering url', ['url' => $url]);
                $ret = DI::httpClient()->fetch($url, HttpClientAccept::HTML);
-               Logger::debug('Check registering answer', ['answer' => $ret]);
-               Logger::info('end');
+               DI::logger()->debug('Check registering answer', ['answer' => $ret]);
+               DI::logger()->info('end');
        }
 }
index 853abc3c95eb6607bcd0718f1e5211680a9a9e4f..85231a046614b1c1e6e62bc482e2ead633aa281b 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
 use Friendica\Database\DBA;
 use Friendica\DI;
 
@@ -20,11 +19,11 @@ class OptimizeTables
        {
 
                if (!DI::lock()->acquire('optimize_tables', 0)) {
-                       Logger::warning('Lock could not be acquired');
+                       DI::logger()->warning('Lock could not be acquired');
                        return;
                }
 
-               Logger::info('Optimize start');
+               DI::logger()->info('Optimize start');
 
                DBA::optimizeTable('cache');
                DBA::optimizeTable('locks');
@@ -60,7 +59,7 @@ class OptimizeTables
                        DBA::optimizeTable('tag');
                }
 
-               Logger::info('Optimize end');
+               DI::logger()->info('Optimize end');
 
                DI::lock()->release('optimize_tables');
        }
index 66b3cc39dab41cd4e14190b689e764a4c5144f8c..9a5405bbc50bf42a749493e5730474cab86ee989 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
@@ -52,7 +51,7 @@ class PollContacts
                        $next_update = DateTimeFormat::utc($contact['last-update'] . ' + ' . $interval . ' minute');
 
                        if ($now < $next_update)  {
-                               Logger::debug('No update', ['cid' => $contact['id'], 'interval' => $interval, 'next' => $next_update, 'now' => $now]);
+                               DI::logger()->debug('No update', ['cid' => $contact['id'], 'interval' => $interval, 'next' => $next_update, 'now' => $now]);
                                continue;
                        }
 
@@ -64,7 +63,7 @@ class PollContacts
                                $priority = Worker::PRIORITY_LOW;
                        }
 
-                       Logger::notice("Polling " . $contact["network"] . " " . $contact["id"] . " " . $contact['priority'] . " " . $contact["nick"] . " " . $contact["name"]);
+                       DI::logger()->notice("Polling " . $contact["network"] . " " . $contact["id"] . " " . $contact['priority'] . " " . $contact["nick"] . " " . $contact["name"]);
 
                        Worker::add(['priority' => $priority, 'dont_fork' => true, 'force_priority' => true], 'OnePoll', (int)$contact['id']);
                        Worker::coolDown();
index 685229b3b5582e44c8782e0f71421d887d6d4092..700da98d8e7b323e6b5ed6f8061b7de63359690f 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
 use Friendica\Core\Worker;
 use Friendica\DI;
 use Friendica\Protocol\Delivery;
@@ -35,7 +34,7 @@ class ProfileUpdate {
                $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid);
 
                foreach ($inboxes as $inbox => $receivers) {
-                       Logger::info('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub');
+                       DI::logger()->info('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub');
                        Worker::add(['priority' => $appHelper->getQueueValue('priority'), 'created' => $appHelper->getQueueValue('created'), 'dont_fork' => true],
                                'APDelivery',
                                Delivery::PROFILEUPDATE,
index 4272b91d68ba466e2017ae9335a77b95e47a0ada..2410be7d962cd7a2fb3c6b54206ca0072b308903 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
 use Friendica\Core\Search;
 use Friendica\DI;
 use Friendica\Model\Contact;
@@ -22,29 +21,29 @@ class PullDirectory
        public static function execute()
        {
                if (!DI::config()->get('system', 'synchronize_directory')) {
-                       Logger::info('Synchronization deactivated');
+                       DI::logger()->info('Synchronization deactivated');
                        return;
                }
 
                $directory = Search::getGlobalDirectory();
                if (empty($directory)) {
-                       Logger::info('No directory configured');
+                       DI::logger()->info('No directory configured');
                        return;
                }
 
                $now = (int)(DI::keyValue()->get('last-directory-sync') ?? 0);
 
-               Logger::info('Synchronization started.', ['now' => $now, 'directory' => $directory]);
+               DI::logger()->info('Synchronization started.', ['now' => $now, 'directory' => $directory]);
 
                $result = DI::httpClient()->fetch($directory . '/sync/pull/since/' . $now, HttpClientAccept::JSON, 0, '', HttpClientRequest::CONTACTDISCOVER);
                if (empty($result)) {
-                       Logger::info('Directory server return empty result.', ['directory' => $directory]);
+                       DI::logger()->info('Directory server return empty result.', ['directory' => $directory]);
                        return;
                }
 
                $contacts = json_decode($result, true);
                if (empty($contacts['results'])) {
-                       Logger::info('No results fetched.', ['directory' => $directory]);
+                       DI::logger()->info('No results fetched.', ['directory' => $directory]);
                        return;
                }
 
@@ -53,6 +52,6 @@ class PullDirectory
                $now = $contacts['now'] ?? 0;
                DI::keyValue()->set('last-directory-sync', $now);
 
-               Logger::info('Synchronization ended', ['now' => $now, 'count' => $result['count'], 'added' => $result['added'], 'updated' => $result['updated'], 'unchanged' => $result['unchanged'], 'directory' => $directory]);
+               DI::logger()->info('Synchronization ended', ['now' => $now, 'count' => $result['count'], 'added' => $result['added'], 'updated' => $result['updated'], 'unchanged' => $result['unchanged'], 'directory' => $directory]);
        }
 }
index 4d47a4b18e6c1facfe350daca6a89cd137b7cf33..b1c07996f10a0193cc06c59c0cf4b733aa41063d 100644 (file)
@@ -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()]);
                }
        }
 }
index 0c83ea2d31c2cd7dbbe2475666a97c20bae222dd..ac7242235f53b2ddabcf79411c3c6561f22c2921 100644 (file)
@@ -8,7 +8,6 @@
 namespace Friendica\Worker;
 
 use Friendica\Core\Cache\Enum\Duration;
-use Friendica\Core\Logger;
 use Friendica\Core\Search;
 use Friendica\DI;
 use Friendica\Model\Contact;
@@ -21,7 +20,7 @@ class SearchDirectory
        public static function execute($search)
        {
                if (!DI::config()->get('system', 'poco_local_search')) {
-                       Logger::info('Local search is not enabled');
+                       DI::logger()->info('Local search is not enabled');
                        return;
                }
 
@@ -29,7 +28,7 @@ class SearchDirectory
                if (!is_null($data)) {
                        // Only search for the same item every 24 hours
                        if (time() < $data + (60 * 60 * 24)) {
-                               Logger::info('Already searched this in the last 24 hours', ['search' => $search]);
+                               DI::logger()->info('Already searched this in the last 24 hours', ['search' => $search]);
                                return;
                        }
                }
index 2428bd8decefb8f84be47c8e6b1c4b0083301812..ea26494abd678392a6396c69194dbe010d6edb6f 100644 (file)
@@ -7,7 +7,7 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
+use Friendica\DI;
 use Friendica\Model\Item;
 
 /**
@@ -18,6 +18,6 @@ class SetSeen
        public static function execute(int $uid)
        {
                $ret = Item::update(['unseen' => false], ['unseen' => true, 'uid' => $uid]);
-               Logger::debug('Set seen', ['uid' => $uid, 'ret' => $ret]);
+               DI::logger()->debug('Set seen', ['uid' => $uid, 'ret' => $ret]);
        }
 }
index 9d0a21f5c37ec3ad7e5330baebfacda955054a5b..aab2b7a975e1d58225e3bd9a88b0bd271188b870 100644 (file)
@@ -7,8 +7,8 @@
 
 namespace Friendica\Worker;
 
-use Friendica\Core\Logger;
 use Friendica\Core\System;
+use Friendica\DI;
 use Friendica\Model\Item;
 
 /**
@@ -24,7 +24,7 @@ class SpoolPost {
 
                                        // It is not named like a spool file, so we don't care.
                                        if (substr($file, 0, 5) != "item-") {
-                                               Logger::info('Spool file does not start with "item-"', ['file' => $file]);
+                                               DI::logger()->info('Spool file does not start with "item-"', ['file' => $file]);
                                                continue;
                                        }
 
@@ -32,13 +32,13 @@ class SpoolPost {
 
                                        // We don't care about directories either
                                        if (filetype($fullfile) != "file") {
-                                               Logger::info('Spool file is no file', ['file' => $file]);
+                                               DI::logger()->info('Spool file is no file', ['file' => $file]);
                                                continue;
                                        }
 
                                        // We can't read or write the file? So we don't care about it.
                                        if (!is_writable($fullfile) || !is_readable($fullfile)) {
-                                               Logger::warning('Spool file has insufficent permissions', ['file' => $file, 'writable' => is_writable($fullfile), 'readable' => is_readable($fullfile)]);
+                                               DI::logger()->warning('Spool file has insufficent permissions', ['file' => $file, 'writable' => is_writable($fullfile), 'readable' => is_readable($fullfile)]);
                                                continue;
                                        }
 
@@ -46,19 +46,19 @@ class SpoolPost {
 
                                        // If it isn't an array then it is no spool file
                                        if (!is_array($arr)) {
-                                               Logger::notice('Spool file is no array', ['file' => $file]);
+                                               DI::logger()->notice('Spool file is no array', ['file' => $file]);
                                                continue;
                                        }
 
                                        // Skip if it doesn't seem to be an item array
                                        if (!isset($arr['uid']) && !isset($arr['uri']) && !isset($arr['network'])) {
-                                               Logger::warning('Spool file does not contain the needed fields', ['file' => $file]);
+                                               DI::logger()->warning('Spool file does not contain the needed fields', ['file' => $file]);
                                                continue;
                                        }
 
                                        $result = Item::insert($arr);
 
-                                       Logger::info('Spool file is stored', ['file' => $file, 'result' => $result]);
+                                       DI::logger()->info('Spool file is stored', ['file' => $file, 'result' => $result]);
                                        unlink($fullfile);
                                }
                                closedir($dh);