]> git.mxchange.org Git - friendica.git/commitdiff
Replace Logger with DI::logger() in Model classes
authorArt4 <art4@wlabs.de>
Mon, 13 Jan 2025 10:16:02 +0000 (10:16 +0000)
committerArt4 <art4@wlabs.de>
Mon, 13 Jan 2025 10:16:02 +0000 (10:16 +0000)
12 files changed:
src/Model/APContact.php
src/Model/Circle.php
src/Model/Event.php
src/Model/GServer.php
src/Model/Item.php
src/Model/ItemURI.php
src/Model/Mail.php
src/Model/Photo.php
src/Model/Profile.php
src/Model/Subscription.php
src/Model/Tag.php
src/Model/User.php

index 10534498ac71afb649db9b99510b0213cf9964ea..e88cccd619a86ae091fc2c0ba635204d62fa67d1 100644 (file)
@@ -9,7 +9,6 @@ namespace Friendica\Model;
 
 use Friendica\Content\Text\HTML;
 use Friendica\Core\Cache\Enum\Duration;
-use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
@@ -95,12 +94,12 @@ class APContact
        public static function getByURL(string $url, bool $update = null): array
        {
                if (empty($url) || Network::isUrlBlocked($url)) {
-                       Logger::info('Domain is blocked', ['url' => $url]);
+                       DI::logger()->info('Domain is blocked', ['url' => $url]);
                        return [];
                }
 
                if (!Network::isValidHttpUrl($url) && !filter_var($url, FILTER_VALIDATE_EMAIL)) {
-                       Logger::info('Invalid URL', ['url' => $url]);
+                       DI::logger()->info('Invalid URL', ['url' => $url]);
                        return [];
                }
 
@@ -156,7 +155,7 @@ class APContact
                $cachekey = 'apcontact:' . ItemURI::getIdByURI($url);
                $result = DI::cache()->get($cachekey);
                if (!is_null($result)) {
-                       Logger::info('Multiple requests for the address', ['url' => $url, 'update' => $update, 'result' => $result]);
+                       DI::logger()->info('Multiple requests for the address', ['url' => $url, 'update' => $update, 'result' => $result]);
                        if (!empty($fetched_contact)) {
                                return $fetched_contact;
                        }
@@ -192,7 +191,7 @@ class APContact
                                        $failed = true;
                                }
                        } catch (\Exception $exception) {
-                               Logger::notice('Error fetching url', ['url' => $url, 'exception' => $exception]);
+                               DI::logger()->notice('Error fetching url', ['url' => $url, 'exception' => $exception]);
                                $failed = true;
                        }
 
@@ -291,7 +290,7 @@ class APContact
                        try {
                                $apcontact['addr'] = $apcontact['nick'] . '@' . (new Uri($apcontact['url']))->getAuthority();
                        } catch (\Throwable $e) {
-                               Logger::warning('Unable to coerce APContact URL into a UriInterface object', ['url' => $apcontact['url'], 'error' => $e->getMessage()]);
+                               DI::logger()->warning('Unable to coerce APContact URL into a UriInterface object', ['url' => $apcontact['url'], 'error' => $e->getMessage()]);
                                $apcontact['addr'] = '';
                        }
                }
@@ -371,7 +370,7 @@ class APContact
                        $apcontact['photo'] = Network::addBasePath($apcontact['photo'], $apcontact['url']);
 
                        if (!Network::isValidHttpUrl($apcontact['photo'])) {
-                               Logger::warning('Invalid URL for photo', ['url' => $apcontact['url'], 'photo' => $apcontact['photo']]);
+                               DI::logger()->warning('Invalid URL for photo', ['url' => $apcontact['url'], 'photo' => $apcontact['photo']]);
                                $apcontact['photo'] = '';
                        }
                }
@@ -457,9 +456,9 @@ class APContact
                                if (in_array($name, APContact\Endpoint::ENDPOINT_NAMES)) {
                                        $key = array_search($name, APContact\Endpoint::ENDPOINT_NAMES);
                                        APContact\Endpoint::update($apcontact['uri-id'], $key, $endpoint['@id']);
-                                       Logger::debug('Store endpoint', ['key' => $key, 'name' => $name, 'endpoint' => $endpoint['@id']]);
+                                       DI::logger()->debug('Store endpoint', ['key' => $key, 'name' => $name, 'endpoint' => $endpoint['@id']]);
                                } elseif (!in_array($name, ['as:sharedInbox', 'as:uploadMedia', 'as:oauthTokenEndpoint', 'as:oauthAuthorizationEndpoint', 'litepub:oauthRegistrationEndpoint'])) {
-                                       Logger::debug('Unknown endpoint', ['name' => $name, 'endpoint' => $endpoint['@id']]);
+                                       DI::logger()->debug('Unknown endpoint', ['name' => $name, 'endpoint' => $endpoint['@id']]);
                                }
                        }
                }
@@ -468,7 +467,7 @@ class APContact
 
                // We delete the old entry when the URL is changed
                if ($url != $apcontact['url']) {
-                       Logger::info('Delete changed profile url', ['old' => $url, 'new' => $apcontact['url']]);
+                       DI::logger()->info('Delete changed profile url', ['old' => $url, 'new' => $apcontact['url']]);
                        DBA::delete('apcontact', ['url' => $url]);
                }
 
@@ -481,7 +480,7 @@ class APContact
                        DBA::replace('apcontact', $apcontact);
                }
 
-               Logger::info('Updated profile', ['url' => $url]);
+               DI::logger()->info('Updated profile', ['url' => $url]);
 
                return DBA::selectFirst('apcontact', [], ['url' => $apcontact['url']]) ?: [];
        }
@@ -532,7 +531,7 @@ class APContact
        public static function markForArchival(array $apcontact)
        {
                if (!empty($apcontact['inbox'])) {
-                       Logger::info('Set inbox status to failure', ['inbox' => $apcontact['inbox']]);
+                       DI::logger()->info('Set inbox status to failure', ['inbox' => $apcontact['inbox']]);
                        HTTPSignature::setInboxStatus($apcontact['inbox'], false, false, $apcontact['gsid']);
                }
 
@@ -542,7 +541,7 @@ class APContact
                                $apcontact['sharedinbox']]);
                        if (!$available) {
                                // If all known personal inboxes are failing then set their shared inbox to failure as well
-                               Logger::info('Set shared inbox status to failure', ['sharedinbox' => $apcontact['sharedinbox']]);
+                               DI::logger()->info('Set shared inbox status to failure', ['sharedinbox' => $apcontact['sharedinbox']]);
                                HTTPSignature::setInboxStatus($apcontact['sharedinbox'], false, true, $apcontact['gsid']);
                        }
                }
@@ -557,11 +556,11 @@ class APContact
        public static function unmarkForArchival(array $apcontact)
        {
                if (!empty($apcontact['inbox'])) {
-                       Logger::info('Set inbox status to success', ['inbox' => $apcontact['inbox']]);
+                       DI::logger()->info('Set inbox status to success', ['inbox' => $apcontact['inbox']]);
                        HTTPSignature::setInboxStatus($apcontact['inbox'], true, false, $apcontact['gsid']);
                }
                if (!empty($apcontact['sharedinbox'])) {
-                       Logger::info('Set shared inbox status to success', ['sharedinbox' => $apcontact['sharedinbox']]);
+                       DI::logger()->info('Set shared inbox status to success', ['sharedinbox' => $apcontact['sharedinbox']]);
                        HTTPSignature::setInboxStatus($apcontact['sharedinbox'], true, true, $apcontact['gsid']);
                }
        }
index a81e359d8b26397cc917d9010dc021be2e014a3e..00b4b16d5d298e6a9e706f8aaf078abac159d1de 100644 (file)
@@ -9,7 +9,6 @@ namespace Friendica\Model;
 
 use Friendica\BaseModule;
 use Friendica\Content\Widget;
-use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\Database\Database;
@@ -495,7 +494,7 @@ class Circle
                }
                DBA::close($stmt);
 
-               Logger::info('Got circles', $display_circles);
+               DI::logger()->info('Got circles', $display_circles);
 
                $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('circle_selection.tpl'), [
                        '$id' => $id,
@@ -608,7 +607,7 @@ class Circle
         */
        public static function getIdForGroup(int $id): int
        {
-               Logger::info('Get id for group id', ['id' => $id]);
+               DI::logger()->info('Get id for group id', ['id' => $id]);
                $contact = Contact::getById($id, ['uid', 'name', 'contact-type', 'manually-approve']);
                if (empty($contact) || ($contact['contact-type'] != Contact::TYPE_COMMUNITY) || !$contact['manually-approve']) {
                        return 0;
@@ -638,7 +637,7 @@ class Circle
         */
        public static function updateMembersForGroup(int $id)
        {
-               Logger::info('Update group members', ['id' => $id]);
+               DI::logger()->info('Update group members', ['id' => $id]);
 
                $contact = Contact::getById($id, ['uid', 'url']);
                if (empty($contact)) {
@@ -673,6 +672,6 @@ class Circle
                }
 
                DBA::delete('group_member', ['gid' => $gid, 'contact-id' => $current]);
-               Logger::info('Updated group members', ['id' => $id, 'count' => DBA::count('group_member', ['gid' => $gid])]);
+               DI::logger()->info('Updated group members', ['id' => $id, 'count' => DBA::count('group_member', ['gid' => $gid])]);
        }
 }
index f98c8cdd0ce5c5aa549dd97bb4a74a0f0ec42daf..86567681e1afd0b3c7d06c8aacc9b29e51aab37c 100644 (file)
@@ -10,7 +10,6 @@ namespace Friendica\Model;
 use Friendica\Content\Feature;
 use Friendica\Content\Text\BBCode;
 use Friendica\Core\Hook;
-use Friendica\Core\Logger;
 use Friendica\Core\Renderer;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
@@ -219,7 +218,7 @@ class Event
                }
 
                DBA::delete('event', ['id' => $event_id]);
-               Logger::info("Deleted event", ['id' => $event_id]);
+               DI::logger()->info("Deleted event", ['id' => $event_id]);
        }
 
        /**
index a0c1be7bfcc9e6f9f36f0896be96d1fd11a36b68..933ca8d74ca456ed2c8f2ce25704a9133deb2b01 100644 (file)
@@ -10,7 +10,6 @@ namespace Friendica\Model;
 use DOMDocument;
 use DOMXPath;
 use Exception;
-use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\Worker;
 use Friendica\Database\Database;
@@ -114,7 +113,7 @@ class GServer
 
                $gserver = DBA::selectFirst('gserver', ['id'], ['nurl' => Strings::normaliseLink($url)]);
                if (DBA::isResult($gserver)) {
-                       Logger::debug('Got ID for URL', ['id' => $gserver['id'], 'url' => $url]);
+                       DI::logger()->debug('Got ID for URL', ['id' => $gserver['id'], 'url' => $url]);
 
                        if (Network::isUrlBlocked($url)) {
                                self::setBlockedById($gserver['id']);
@@ -336,7 +335,7 @@ class GServer
                }
 
                if (Network::isUrlBlocked($server_url)) {
-                       Logger::info('Server is blocked', ['url' => $server_url]);
+                       DI::logger()->info('Server is blocked', ['url' => $server_url]);
                        self::setBlockedByUrl($server_url);
                        return false;
                }
@@ -350,12 +349,12 @@ class GServer
                        }
 
                        if (!$force && (strtotime($gserver['next_contact']) > time())) {
-                               Logger::info('No update needed', ['server' => $server_url]);
+                               DI::logger()->info('No update needed', ['server' => $server_url]);
                                return (!$gserver['failed']);
                        }
-                       Logger::info('Server is outdated. Start discovery.', ['Server' => $server_url, 'Force' => $force]);
+                       DI::logger()->info('Server is outdated. Start discovery.', ['Server' => $server_url, 'Force' => $force]);
                } else {
-                       Logger::info('Server is unknown. Start discovery.', ['Server' => $server_url]);
+                       DI::logger()->info('Server is unknown. Start discovery.', ['Server' => $server_url]);
                }
 
                return self::detect($server_url, $network, $only_nodeinfo);
@@ -381,7 +380,7 @@ class GServer
                                $fields['network'] = $network;
                        }
                        self::update($fields, ['id' => $gsid]);
-                       Logger::info('Reset failed status for server', ['url' => $gserver['url']]);
+                       DI::logger()->info('Reset failed status for server', ['url' => $gserver['url']]);
 
                        if (strtotime($gserver['next_contact']) < time()) {
                                UpdateGServer::add(Worker::PRIORITY_LOW, $gserver['url']);
@@ -403,7 +402,7 @@ class GServer
                $gserver = DBA::selectFirst('gserver', ['url', 'failed', 'next_contact'], ['id' => $gsid]);
                if (DBA::isResult($gserver) && !$gserver['failed']) {
                        self::update(['failed' => true, 'blocked' => Network::isUrlBlocked($gserver['url']), 'last_failure' => DateTimeFormat::utcNow()], ['id' => $gsid]);
-                       Logger::info('Set failed status for server', ['url' => $gserver['url']]);
+                       DI::logger()->info('Set failed status for server', ['url' => $gserver['url']]);
 
                        if (strtotime($gserver['next_contact']) < time()) {
                                UpdateGServer::add(Worker::PRIORITY_LOW, $gserver['url']);
@@ -416,7 +415,7 @@ class GServer
                $gserver = DBA::selectFirst('gserver', ['url'], ["(`blocked` OR `blocked` IS NULL) AND `id` = ?", $gsid]);
                if (DBA::isResult($gserver)) {
                        self::update(['blocked' => false], ['id' => $gsid]);
-                       Logger::info('Set unblocked status for server', ['url' => $gserver['url']]);
+                       DI::logger()->info('Set unblocked status for server', ['url' => $gserver['url']]);
                }
        }
 
@@ -425,7 +424,7 @@ class GServer
                $gserver = DBA::selectFirst('gserver', ['url'], ["(NOT `blocked` OR `blocked` IS NULL) AND `id` = ?", $gsid]);
                if (DBA::isResult($gserver)) {
                        self::update(['blocked' => true, 'failed' => true], ['id' => $gsid]);
-                       Logger::info('Set blocked status for server', ['url' => $gserver['url']]);
+                       DI::logger()->info('Set blocked status for server', ['url' => $gserver['url']]);
                }
        }
 
@@ -434,7 +433,7 @@ class GServer
                $gserver = DBA::selectFirst('gserver', ['url', 'id'], ["(NOT `blocked` OR `blocked` IS NULL) AND `nurl` = ?", Strings::normaliseLink($url)]);
                if (DBA::isResult($gserver)) {
                        self::update(['blocked' => true, 'failed' => true], ['id' => $gserver['id']]);
-                       Logger::info('Set blocked status for server', ['url' => $gserver['url']]);
+                       DI::logger()->info('Set blocked status for server', ['url' => $gserver['url']]);
                }
        }
 
@@ -454,7 +453,7 @@ class GServer
                        self::update(['url' => $url, 'failed' => true, 'blocked' => Network::isUrlBlocked($url), 'last_failure' => DateTimeFormat::utcNow(),
                        'next_contact' => $next_update, 'network' => Protocol::PHANTOM, 'detection-method' => null],
                        ['nurl' => $nurl]);
-                       Logger::info('Set failed status for existing server', ['url' => $url]);
+                       DI::logger()->info('Set failed status for existing server', ['url' => $url]);
                        if (self::isDefunct($gserver)) {
                                self::archiveContacts($gserver['id']);
                        }
@@ -464,7 +463,7 @@ class GServer
                self::insert(['url' => $url, 'nurl' => $nurl,
                        'network' => Protocol::PHANTOM, 'created' => DateTimeFormat::utcNow(),
                        'failed' => true, 'last_failure' => DateTimeFormat::utcNow()]);
-               Logger::info('Set failed status for new server', ['url' => $url]);
+               DI::logger()->info('Set failed status for new server', ['url' => $url]);
        }
 
        /**
@@ -493,7 +492,7 @@ class GServer
                try {
                        return (string)self::cleanUri(new Uri($dirtyUrl));
                } catch (\Throwable $e) {
-                       Logger::warning('Invalid URL', ['dirtyUrl' => $dirtyUrl]);
+                       DI::logger()->warning('Invalid URL', ['dirtyUrl' => $dirtyUrl]);
                        return '';
                }
        }
@@ -533,14 +532,14 @@ class GServer
         */
        private static function detect(string $url, string $network = '', bool $only_nodeinfo = false): bool
        {
-               Logger::info('Detect server type', ['server' => $url]);
+               DI::logger()->info('Detect server type', ['server' => $url]);
 
                $original_url = $url;
 
                // Remove URL content that is not supposed to exist for a server url
                $url = rtrim(self::cleanURL($url), '/');
                if (empty($url)) {
-                       Logger::notice('Empty URL.');
+                       DI::logger()->notice('Empty URL.');
                        return false;
                }
 
@@ -566,7 +565,7 @@ class GServer
                        // Some systems have got redirects on their landing page to a single account page. This check handles it.
                        if (((parse_url($url, PHP_URL_HOST) != parse_url($valid_url, PHP_URL_HOST)) && (parse_url($url, PHP_URL_PATH) == parse_url($valid_url, PHP_URL_PATH))) ||
                        (((parse_url($url, PHP_URL_HOST) != parse_url($valid_url, PHP_URL_HOST)) || (parse_url($url, PHP_URL_PATH) != parse_url($valid_url, PHP_URL_PATH))) && empty(parse_url($valid_url, PHP_URL_PATH)))) {
-                               Logger::debug('Found redirect. Mark old entry as failure', ['old' => $url, 'new' => $valid_url]);
+                               DI::logger()->debug('Found redirect. Mark old entry as failure', ['old' => $url, 'new' => $valid_url]);
                                self::setFailureByUrl($url);
                                if (!self::getID($valid_url, true) && !Network::isUrlBlocked($valid_url)) {
                                        self::detect($valid_url, $network, $only_nodeinfo);
@@ -576,7 +575,7 @@ class GServer
 
                        if ((parse_url($url, PHP_URL_HOST) != parse_url($valid_url, PHP_URL_HOST)) && (parse_url($url, PHP_URL_PATH) != parse_url($valid_url, PHP_URL_PATH)) &&
                        (parse_url($url, PHP_URL_PATH) == '')) {
-                               Logger::debug('Found redirect. Mark old entry as failure and redirect to the basepath.', ['old' => $url, 'new' => $valid_url]);
+                               DI::logger()->debug('Found redirect. Mark old entry as failure and redirect to the basepath.', ['old' => $url, 'new' => $valid_url]);
                                $parts = (array)parse_url($valid_url);
                                unset($parts['path']);
                                $valid_url = (string)Uri::fromParts($parts);
@@ -587,7 +586,7 @@ class GServer
                                }
                                return false;
                        }
-                       Logger::debug('Found redirect, but ignore it.', ['old' => $url, 'new' => $valid_url]);
+                       DI::logger()->debug('Found redirect, but ignore it.', ['old' => $url, 'new' => $valid_url]);
                }
 
                if ((parse_url($url, PHP_URL_HOST) == parse_url($valid_url, PHP_URL_HOST)) &&
@@ -617,7 +616,7 @@ class GServer
                }
 
                if ($only_nodeinfo && empty($serverdata)) {
-                       Logger::info('Invalid nodeinfo in nodeinfo-mode, server is marked as failure', ['url' => $url]);
+                       DI::logger()->info('Invalid nodeinfo in nodeinfo-mode, server is marked as failure', ['url' => $url]);
                        self::setFailureByUrl($url);
                        return false;
                } elseif (empty($serverdata)) {
@@ -820,14 +819,14 @@ class GServer
                        $contacts = DBA::count('contact', ['uid' => 0, 'gsid' => $id, 'failed' => false]);
                        $max_users = max($apcontacts, $contacts);
                        if ($max_users > $serverdata['registered-users']) {
-                               Logger::info('Update registered users', ['id' => $id, 'url' => $serverdata['nurl'], 'registered-users' => $max_users]);
+                               DI::logger()->info('Update registered users', ['id' => $id, 'url' => $serverdata['nurl'], 'registered-users' => $max_users]);
                                self::update(['registered-users' => $max_users], ['id' => $id]);
                        }
 
                        if (empty($serverdata['active-month-users'])) {
                                $contacts = DBA::count('contact', ["`uid` = ? AND `gsid` = ? AND NOT `failed` AND `last-item` > ?", 0, $id, DateTimeFormat::utc('now - 30 days')]);
                                if ($contacts > 0) {
-                                       Logger::info('Update monthly users', ['id' => $id, 'url' => $serverdata['nurl'], 'monthly-users' => $contacts]);
+                                       DI::logger()->info('Update monthly users', ['id' => $id, 'url' => $serverdata['nurl'], 'monthly-users' => $contacts]);
                                        self::update(['active-month-users' => $contacts], ['id' => $id]);
                                }
                        }
@@ -835,7 +834,7 @@ class GServer
                        if (empty($serverdata['active-halfyear-users'])) {
                                $contacts = DBA::count('contact', ["`uid` = ? AND `gsid` = ? AND NOT `failed` AND `last-item` > ?", 0, $id, DateTimeFormat::utc('now - 180 days')]);
                                if ($contacts > 0) {
-                                       Logger::info('Update halfyear users', ['id' => $id, 'url' => $serverdata['nurl'], 'halfyear-users' => $contacts]);
+                                       DI::logger()->info('Update halfyear users', ['id' => $id, 'url' => $serverdata['nurl'], 'halfyear-users' => $contacts]);
                                        self::update(['active-halfyear-users' => $contacts], ['id' => $id]);
                                }
                        }
@@ -847,7 +846,7 @@ class GServer
 
                if (!empty($systemactor)) {
                        $contact = Contact::getByURL($systemactor, true, ['gsid', 'baseurl', 'id', 'network', 'url', 'name']);
-                       Logger::debug('Fetched system actor',  ['url' => $url, 'gsid' => $id, 'contact' => $contact]);
+                       DI::logger()->debug('Fetched system actor',  ['url' => $url, 'gsid' => $id, 'contact' => $contact]);
                }
 
                return $ret;
@@ -864,7 +863,7 @@ class GServer
         */
        private static function discoverRelay(string $server_url)
        {
-               Logger::info('Discover relay data', ['server' => $server_url]);
+               DI::logger()->info('Discover relay data', ['server' => $server_url]);
 
                $curlResult = DI::httpClient()->get($server_url . '/.well-known/x-social-relay', HttpClientAccept::JSON, [HttpClientOptions::REQUEST => HttpClientRequest::SERVERINFO]);
                if (!$curlResult->isSuccess()) {
@@ -947,7 +946,7 @@ class GServer
                        }
                }
 
-               Logger::info('Discovery ended', ['server' => $server_url, 'data' => $fields]);
+               DI::logger()->info('Discovery ended', ['server' => $server_url, 'data' => $fields]);
 
                Relay::updateContact($gserver, $fields);
        }
@@ -1072,7 +1071,7 @@ class GServer
 
                foreach ($nodeinfo['links'] as $link) {
                        if (!is_array($link) || empty($link['rel']) || empty($link['href'])) {
-                               Logger::info('Invalid nodeinfo format', ['url' => $url]);
+                               DI::logger()->info('Invalid nodeinfo format', ['url' => $url]);
                                continue;
                        }
 
@@ -2277,7 +2276,7 @@ class GServer
                                $serverdata['register_policy'] = Register::CLOSED;
                                break;
                        default:
-                               Logger::info('Register policy is invalid', ['policy' => $register_policy, 'server' => $url]);
+                               DI::logger()->info('Register policy is invalid', ['policy' => $register_policy, 'server' => $url]);
                                $serverdata['register_policy'] = Register::CLOSED;
                                break;
                }
@@ -2507,10 +2506,10 @@ class GServer
                        ['order' => ['RAND()']]);
 
                while ($gserver = DBA::fetch($gservers)) {
-                       Logger::info('Update peer list', ['server' => $gserver['url'], 'id' => $gserver['id']]);
+                       DI::logger()->info('Update peer list', ['server' => $gserver['url'], 'id' => $gserver['id']]);
                        Worker::add(Worker::PRIORITY_LOW, 'UpdateServerPeers', $gserver['url']);
 
-                       Logger::info('Update directory', ['server' => $gserver['url'], 'id' => $gserver['id']]);
+                       DI::logger()->info('Update directory', ['server' => $gserver['url'], 'id' => $gserver['id']]);
                        Worker::add(Worker::PRIORITY_LOW, 'UpdateServerDirectory', $gserver);
 
                        $fields = ['last_poco_query' => DateTimeFormat::utcNow()];
@@ -2651,7 +2650,7 @@ class GServer
                        }
                }
 
-               Logger::info('Protocol for server', ['protocol' => $protocol, 'old' => $old, 'id' => $gsid, 'url' => $gserver['url']]);
+               DI::logger()->info('Protocol for server', ['protocol' => $protocol, 'old' => $old, 'id' => $gsid, 'url' => $gserver['url']]);
                self::update(['protocol' => $protocol], ['id' => $gsid]);
        }
 
index 594185c451ed7447e9b2a0981805e0ee2cd6f3fb..64cf1d7968df4af7fefd2ef369aff5e319ddb435 100644 (file)
@@ -16,7 +16,6 @@ use Friendica\Content\Text\BBCode;
 use Friendica\Content\Text\HTML;
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
-use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\Core\System;
@@ -215,7 +214,7 @@ class Item
                        return $rows;
                }
 
-               Logger::info('Updating per single row method', ['fields' => $fields, 'condition' => $condition]);
+               DI::logger()->info('Updating per single row method', ['fields' => $fields, 'condition' => $condition]);
 
                $items = Post::select(['id', 'origin', 'uri-id', 'uid', 'author-network', 'quote-uri-id'], $condition);
 
@@ -236,7 +235,7 @@ class Item
                                if ($item['origin'] && empty($item['quote-uri-id'])) {
                                        $quote_id = Post\Media::getActivityUriId($item['uri-id']);
                                        if (!empty($quote_id)) {
-                                               Logger::notice('Found attached post', ['id' => $quote_id, 'guid' => $item['guid'], 'uri-id' => $item['uri-id']]);
+                                               DI::logger()->notice('Found attached post', ['id' => $quote_id, 'guid' => $item['guid'], 'uri-id' => $item['uri-id']]);
                                                $content_fields['quote-uri-id'] = $quote_id;
                                        }
                                }
@@ -332,7 +331,7 @@ class Item
                        if ($item['uid'] == $uid) {
                                self::markForDeletionById($item['id'], Worker::PRIORITY_HIGH);
                        } elseif ($item['uid'] != 0) {
-                               Logger::warning('Wrong ownership. Not deleting item', ['id' => $item['id']]);
+                               DI::logger()->warning('Wrong ownership. Not deleting item', ['id' => $item['id']]);
                        }
                }
                DBA::close($items);
@@ -348,7 +347,7 @@ class Item
         */
        public static function markForDeletionById(int $item_id, int $priority = Worker::PRIORITY_HIGH): bool
        {
-               Logger::info('Mark item for deletion by id', ['id' => $item_id]);
+               DI::logger()->info('Mark item for deletion by id', ['id' => $item_id]);
                // locate item to be deleted
                $fields = [
                        'id', 'uri', 'uri-id', 'uid', 'parent', 'parent-uri-id', 'origin',
@@ -357,12 +356,12 @@ class Item
                ];
                $item = Post::selectFirst($fields, ['id' => $item_id]);
                if (!DBA::isResult($item)) {
-                       Logger::info('Item not found.', ['id' => $item_id]);
+                       DI::logger()->info('Item not found.', ['id' => $item_id]);
                        return false;
                }
 
                if ($item['deleted']) {
-                       Logger::info('Item has already been marked for deletion.', ['id' => $item_id]);
+                       DI::logger()->info('Item has already been marked for deletion.', ['id' => $item_id]);
                        return false;
                }
 
@@ -444,7 +443,7 @@ class Item
                        Post\Counts::update($item['thr-parent-id'], $item['parent-uri-id'], $item['vid'], $item['verb'], $item['body']);
                }
 
-               Logger::info('Item has been marked for deletion.', ['id' => $item_id]);
+               DI::logger()->info('Item has been marked for deletion.', ['id' => $item_id]);
 
                return true;
        }
@@ -554,7 +553,7 @@ class Item
                        return $contact_id;
                }
 
-               Logger::warning('contact-id could not be fetched, using self contact instead.', ['uid' => $item['uid'], 'item' => $item]);
+               DI::logger()->warning('contact-id could not be fetched, using self contact instead.', ['uid' => $item['uid'], 'item' => $item]);
                $self = Contact::selectFirst(['id'], ['self' => true, 'uid' => $item['uid']]);
                return $self['id'];
        }
@@ -577,7 +576,7 @@ class Item
                        $spool = $spoolpath . '/' . $file;
 
                        file_put_contents($spool, json_encode($item));
-                       Logger::warning("Item wasn't stored - Item was spooled into file", ['file' => $file]);
+                       DI::logger()->warning("Item wasn't stored - Item was spooled into file", ['file' => $file]);
                }
        }
 
@@ -592,7 +591,7 @@ class Item
                // Checking if there is already an item with the same guid
                $condition = ['guid' => $item['guid'], 'network' => $item['network'], 'uid' => $item['uid']];
                if (Post::exists($condition)) {
-                       Logger::notice('Found already existing item', $condition);
+                       DI::logger()->notice('Found already existing item', $condition);
                        return true;
                }
 
@@ -601,7 +600,7 @@ class Item
                        'network' => [$item['network'], Protocol::DFRN]
                ];
                if (Post::exists($condition)) {
-                       Logger::notice('duplicated item with the same uri found.', $condition);
+                       DI::logger()->notice('duplicated item with the same uri found.', $condition);
                        return true;
                }
 
@@ -609,7 +608,7 @@ class Item
                if (in_array($item['network'], [Protocol::DFRN, Protocol::DIASPORA])) {
                        $condition = ['guid' => $item['guid'], 'uid' => $item['uid']];
                        if (Post::exists($condition)) {
-                               Logger::notice('duplicated item with the same guid found.', $condition);
+                               DI::logger()->notice('duplicated item with the same guid found.', $condition);
                                return true;
                        }
                }
@@ -620,7 +619,7 @@ class Item
                 * An unique index would help - but the limitations of MySQL (maximum size of index values) prevent this.
                 */
                if (($item['uid'] == 0) && Post::exists(['uri-id' => $item['uri-id'], 'uid' => 0])) {
-                       Logger::notice('Global item already stored.', ['uri-id' => $item['uri-id'], 'network' => $item['network']]);
+                       DI::logger()->notice('Global item already stored.', ['uri-id' => $item['uri-id'], 'network' => $item['network']]);
                        return true;
                }
 
@@ -637,47 +636,47 @@ class Item
        {
                // When there is no content then we don't post it
                if (($item['body'] . $item['title'] == '') && empty($item['quote-uri-id']) && empty($item['attachments']) && (empty($item['uri-id']) || !Post\Media::existsByURIId($item['uri-id']))) {
-                       Logger::notice('No body, no title.');
+                       DI::logger()->notice('No body, no title.');
                        return false;
                }
 
                if (!empty($item['uid'])) {
                        $owner = User::getOwnerDataById($item['uid'], false);
                        if (!$owner) {
-                               Logger::warning('Missing item user owner data', ['uid' => $item['uid']]);
+                               DI::logger()->warning('Missing item user owner data', ['uid' => $item['uid']]);
                                return false;
                        }
 
                        if ($owner['account_expired'] || $owner['account_removed']) {
-                               Logger::notice('Item user has been deleted/expired/removed', ['uid' => $item['uid'], 'deleted' => $owner['deleted'], 'account_expired' => $owner['account_expired'], 'account_removed' => $owner['account_removed']]);
+                               DI::logger()->notice('Item user has been deleted/expired/removed', ['uid' => $item['uid'], 'deleted' => $owner['deleted'], 'account_expired' => $owner['account_expired'], 'account_removed' => $owner['account_removed']]);
                                return false;
                        }
                }
 
                if (!empty($item['author-id']) && Contact::isBlocked($item['author-id'])) {
-                       Logger::notice('Author is blocked node-wide', ['author-link' => $item['author-link'], 'item-uri' => $item['uri']]);
+                       DI::logger()->notice('Author is blocked node-wide', ['author-link' => $item['author-link'], 'item-uri' => $item['uri']]);
                        return false;
                }
 
                if (!empty($item['author-link']) && Network::isUrlBlocked($item['author-link'])) {
-                       Logger::notice('Author server is blocked', ['author-link' => $item['author-link'], 'item-uri' => $item['uri']]);
+                       DI::logger()->notice('Author server is blocked', ['author-link' => $item['author-link'], 'item-uri' => $item['uri']]);
                        return false;
                }
 
                if (!empty($item['owner-id']) && Contact::isBlocked($item['owner-id'])) {
-                       Logger::notice('Owner is blocked node-wide', ['owner-link' => $item['owner-link'], 'item-uri' => $item['uri']]);
+                       DI::logger()->notice('Owner is blocked node-wide', ['owner-link' => $item['owner-link'], 'item-uri' => $item['uri']]);
                        return false;
                }
 
                if (!empty($item['owner-link']) && Network::isUrlBlocked($item['owner-link'])) {
-                       Logger::notice('Owner server is blocked', ['owner-link' => $item['owner-link'], 'item-uri' => $item['uri']]);
+                       DI::logger()->notice('Owner server is blocked', ['owner-link' => $item['owner-link'], 'item-uri' => $item['uri']]);
                        return false;
                }
 
                if ($item['verb'] == Activity::FOLLOW) {
                        if (!$item['origin'] && ($item['author-id'] == Contact::getPublicIdByUserId($item['uid']))) {
                                // Our own follow request can be relayed to us. We don't store it to avoid notification chaos.
-                               Logger::info("Follow: Don't store not origin follow request", ['parent-uri' => $item['parent-uri']]);
+                               DI::logger()->info("Follow: Don't store not origin follow request", ['parent-uri' => $item['parent-uri']]);
                                return false;
                        }
 
@@ -687,7 +686,7 @@ class Item
                        ];
                        if (Post::exists($condition)) {
                                // It happens that we receive multiple follow requests by the same author - we only store one.
-                               Logger::info('Follow: Found existing follow request from author', ['author-id' => $item['author-id'], 'parent-uri' => $item['parent-uri']]);
+                               DI::logger()->info('Follow: Found existing follow request from author', ['author-id' => $item['author-id'], 'parent-uri' => $item['parent-uri']]);
                                return false;
                        }
                }
@@ -716,7 +715,7 @@ class Item
                        if (DBA::isResult($existing)) {
                                // We only log the entries with a different user id than 0. Otherwise we would have too many false positives
                                if ($item['uid'] != 0) {
-                                       Logger::notice('Item already existed for user', [
+                                       DI::logger()->notice('Item already existed for user', [
                                                'uri-id' => $item['uri-id'],
                                                'uid' => $item['uid'],
                                                'network' => $item['network'],
@@ -776,18 +775,18 @@ class Item
                                $stored = Item::storeForUserByUriId($item['parent-uri-id'], $item['uid'], ['post-reason' => Item::PR_COMPLETION]);
                        }
                        if ($stored) {
-                               Logger::info('Stored thread parent item for user', ['uri-id' => $item['thr-parent-id'], 'uid' => $item['uid'], 'stored' => $stored]);
+                               DI::logger()->info('Stored thread parent item for user', ['uri-id' => $item['thr-parent-id'], 'uid' => $item['uid'], 'stored' => $stored]);
                                $parent = Post::selectFirst($fields, $condition, $params);
                        }
                }
 
                if (!DBA::isResult($parent)) {
-                       Logger::notice('item parent was not found - ignoring item', ['uri-id' => $item['uri-id'], 'thr-parent-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
+                       DI::logger()->notice('item parent was not found - ignoring item', ['uri-id' => $item['uri-id'], 'thr-parent-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
                        return [];
                }
 
                if (self::hasRestrictions($item, $parent['author-id'], $parent['restrictions'])) {
-                       Logger::notice('Restrictions apply - ignoring item', ['restrictions' => $parent['restrictions'], 'verb' => $parent['verb'], 'uri-id' => $item['uri-id'], 'thr-parent-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
+                       DI::logger()->notice('Restrictions apply - ignoring item', ['restrictions' => $parent['restrictions'], 'verb' => $parent['verb'], 'uri-id' => $item['uri-id'], 'thr-parent-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
                        return [];
                }
 
@@ -805,12 +804,12 @@ class Item
 
                if (!DBA::isResult($toplevel_parent) && $item['origin']) {
                        $stored = Item::storeForUserByUriId($item['parent-uri-id'], $item['uid'], ['post-reason' => Item::PR_COMPLETION]);
-                       Logger::info('Stored parent item for user', ['uri-id' => $item['parent-uri-id'], 'uid' => $item['uid'], 'stored' => $stored]);
+                       DI::logger()->info('Stored parent item for user', ['uri-id' => $item['parent-uri-id'], 'uid' => $item['uid'], 'stored' => $stored]);
                        $toplevel_parent = Post::selectFirst($fields, $condition, $params);
                }
 
                if (!DBA::isResult($toplevel_parent)) {
-                       Logger::notice('item top level parent was not found - ignoring item', ['parent-uri-id' => $parent['parent-uri-id'], 'uid' => $parent['uid']]);
+                       DI::logger()->notice('item top level parent was not found - ignoring item', ['parent-uri-id' => $parent['parent-uri-id'], 'uid' => $parent['uid']]);
                        return [];
                }
 
@@ -839,7 +838,7 @@ class Item
                        return self::GRAVITY_ACTIVITY;
                }
 
-               Logger::info('Unknown gravity for verb', ['verb' => $item['verb']]);
+               DI::logger()->info('Unknown gravity for verb', ['verb' => $item['verb']]);
                return self::GRAVITY_UNKNOWN;   // Should not happen
        }
 
@@ -971,7 +970,7 @@ class Item
                if (($uid != 0) && ($item['network'] == Protocol::DIASPORA)) {
                        $user = User::getById($uid, ['account-type']);
                        if ($user['account-type'] == Contact::TYPE_COMMUNITY) {
-                               Logger::info('Community posts are not supported via Diaspora');
+                               DI::logger()->info('Community posts are not supported via Diaspora');
                                return 0;
                        }
                }
@@ -1014,7 +1013,7 @@ class Item
                        !empty($item['direction']) && in_array($item['direction'], [Conversation::PUSH, Conversation::RELAY]) &&
                        empty($item['origin']) && DI::contentItem()->isTooOld($item['created'], $item['uid'])
                ) {
-                       Logger::info('Item is too old', ['item' => $item]);
+                       DI::logger()->info('Item is too old', ['item' => $item]);
                        return 0;
                }
 
@@ -1067,7 +1066,7 @@ class Item
                        // If its a post that originated here then tag the thread as "mention"
                        if ($item['origin'] && $item['uid']) {
                                DBA::update('post-thread-user', ['mention' => true], ['uri-id' => $item['parent-uri-id'], 'uid' => $item['uid']]);
-                               Logger::info('tagged thread as mention', ['parent' => $parent_id, 'parent-uri-id' => $item['parent-uri-id'], 'uid' => $item['uid']]);
+                               DI::logger()->info('tagged thread as mention', ['parent' => $parent_id, 'parent-uri-id' => $item['parent-uri-id'], 'uid' => $item['uid']]);
                        }
 
                        // Update the contact relations
@@ -1149,7 +1148,7 @@ class Item
                }
 
                if (!empty($item['cancel'])) {
-                       Logger::notice('post cancelled by addon.');
+                       DI::logger()->notice('post cancelled by addon.');
                        return 0;
                }
 
@@ -1193,13 +1192,13 @@ class Item
                        if (!empty($quote_id)) {
                                // This is one of these "should not happen" situations.
                                // The protocol implementations should already have done this job.
-                               Logger::notice('Quote-uri-id detected in post', ['id' => $quote_id, 'guid' => $item['guid'], 'uri-id' => $item['uri-id']]);
+                               DI::logger()->notice('Quote-uri-id detected in post', ['id' => $quote_id, 'guid' => $item['guid'], 'uri-id' => $item['uri-id']]);
                                $item['quote-uri-id'] = $quote_id;
                        }
                }
 
                if (!empty($item['quote-uri-id']) && ($item['quote-uri-id'] == $item['uri-id'])) {
-                       Logger::info('Quote-Uri-Id is identical to Uri-Id', ['uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
+                       DI::logger()->info('Quote-Uri-Id is identical to Uri-Id', ['uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
                        unset($item['quote-uri-id']);
                }
 
@@ -1232,7 +1231,7 @@ class Item
                if ($item['origin'] && empty($item['quote-uri-id'])) {
                        $quote_id = Post\Media::getActivityUriId($item['uri-id']);
                        if (!empty($quote_id)) {
-                               Logger::notice('Found attached post', ['id' => $quote_id, 'guid' => $item['guid'], 'uri-id' => $item['uri-id']]);
+                               DI::logger()->notice('Found attached post', ['id' => $quote_id, 'guid' => $item['guid'], 'uri-id' => $item['uri-id']]);
                                $item['quote-uri-id'] = $quote_id;
                        }
                }
@@ -1242,7 +1241,7 @@ class Item
 
                        $ev = Event::fromBBCode($item['body']);
                        if ((!empty($ev['desc']) || !empty($ev['summary'])) && !empty($ev['start'])) {
-                               Logger::info('Event found.');
+                               DI::logger()->info('Event found.');
                                $ev['cid']       = $item['contact-id'];
                                $ev['uid']       = $item['uid'];
                                $ev['uri']       = $item['uri'];
@@ -1263,7 +1262,7 @@ class Item
                                $event_id = Event::store($ev);
                                $item = Event::getItemArrayForImportedId($event_id, $item);
 
-                               Logger::info('Event was stored', ['id' => $event_id]);
+                               DI::logger()->info('Event was stored', ['id' => $event_id]);
                        }
                }
 
@@ -1328,13 +1327,13 @@ class Item
 
                $condition = ['uri-id' => $item['uri-id'], 'uid' => $item['uid']];
                if (Post::exists($condition)) {
-                       Logger::notice('Item is already inserted - aborting', $condition);
+                       DI::logger()->notice('Item is already inserted - aborting', $condition);
                        return 0;
                }
 
                $post_user_id = Post\User::insert($item['uri-id'], $item['uid'], $item);
                if (!$post_user_id) {
-                       Logger::notice('Post-User is already inserted - aborting', ['uid' => $item['uid'], 'uri-id' => $item['uri-id']]);
+                       DI::logger()->notice('Post-User is already inserted - aborting', ['uid' => $item['uid'], 'uri-id' => $item['uri-id']]);
                        return 0;
                }
 
@@ -1343,12 +1342,12 @@ class Item
                        Post\ThreadUser::insert($item['uri-id'], $item['uid'], $item);
                }
 
-               Logger::notice('created item', ['post-id' => $post_user_id, 'uid' => $item['uid'], 'network' => $item['network'], 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
+               DI::logger()->notice('created item', ['post-id' => $post_user_id, 'uid' => $item['uid'], 'network' => $item['network'], 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
 
                $posted_item = Post::selectFirst(self::ITEM_FIELDLIST, ['post-user-id' => $post_user_id]);
                if (!DBA::isResult($posted_item)) {
                        // On failure store the data into a spool file so that the "SpoolPost" worker can try again later.
-                       Logger::warning('Could not store item. it will be spooled', ['id' => $post_user_id]);
+                       DI::logger()->warning('Could not store item. it will be spooled', ['id' => $post_user_id]);
                        self::spool($orig_item);
                        return 0;
                }
@@ -1385,7 +1384,7 @@ class Item
                        // Get the user information for the logging
                        $user = User::getById($uid);
 
-                       Logger::notice('Item had been deleted', ['id' => $post_user_id, 'user' => $uid, 'account-type' => $user['account-type']]);
+                       DI::logger()->notice('Item had been deleted', ['id' => $post_user_id, 'user' => $uid, 'account-type' => $user['account-type']]);
                        return 0;
                }
 
@@ -1418,15 +1417,15 @@ class Item
 
                if ($transmit) {
                        if ($posted_item['uid'] && Contact\User::isBlocked($posted_item['author-id'], $posted_item['uid'])) {
-                               Logger::info('Message from blocked author will not be relayed', ['item' => $posted_item['id'], 'uri' => $posted_item['uri'], 'cid' => $posted_item['author-id']]);
+                               DI::logger()->info('Message from blocked author will not be relayed', ['item' => $posted_item['id'], 'uri' => $posted_item['uri'], 'cid' => $posted_item['author-id']]);
                                $transmit = false;
                        }
                        if ($transmit && $posted_item['uid'] && Contact\User::isBlocked($posted_item['owner-id'], $posted_item['uid'])) {
-                               Logger::info('Message from blocked owner will not be relayed', ['item' => $posted_item['id'], 'uri' => $posted_item['uri'], 'cid' => $posted_item['owner-id']]);
+                               DI::logger()->info('Message from blocked owner will not be relayed', ['item' => $posted_item['id'], 'uri' => $posted_item['uri'], 'cid' => $posted_item['owner-id']]);
                                $transmit = false;
                        }
                        if ($transmit && !empty($posted_item['causer-id']) && $posted_item['uid'] && Contact\User::isBlocked($posted_item['causer-id'], $posted_item['uid'])) {
-                               Logger::info('Message from blocked causer will not be relayed', ['item' => $posted_item['id'], 'uri' => $posted_item['uri'], 'cid' => $posted_item['causer-id']]);
+                               DI::logger()->info('Message from blocked causer will not be relayed', ['item' => $posted_item['id'], 'uri' => $posted_item['uri'], 'cid' => $posted_item['causer-id']]);
                                $transmit = false;
                        }
 
@@ -1434,7 +1433,7 @@ class Item
                        if (($posted_item['verb'] == Activity::FOLLOW) &&
                                (!$posted_item['origin'] || ($posted_item['author-id'] != Contact::getPublicIdByUserId($uid)))
                        ) {
-                               Logger::info('Participation messages will not be relayed', ['item' => $posted_item['id'], 'uri' => $posted_item['uri'], 'verb' => $posted_item['verb']]);
+                               DI::logger()->info('Participation messages will not be relayed', ['item' => $posted_item['id'], 'uri' => $posted_item['uri'], 'verb' => $posted_item['verb']]);
                                $transmit = false;
                        }
                }
@@ -1520,25 +1519,25 @@ class Item
 
                $item = Post::selectFirst(['id', 'private', 'network', 'language', 'owner-id'], ['uri-id' => $uri_id, 'uid' => 0]);
                if (empty($item['id'])) {
-                       Logger::debug('Post not found', ['uri-id' => $uri_id]);
+                       DI::logger()->debug('Post not found', ['uri-id' => $uri_id]);
                        return;
                }
 
                if (($item['private'] != self::PUBLIC) || !in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN])) {
-                       Logger::debug('Not a public post or no AP or DFRN post', ['uri-id' => $uri_id]);
+                       DI::logger()->debug('Not a public post or no AP or DFRN post', ['uri-id' => $uri_id]);
                        return;
                }
 
                $engagement = DBA::selectFirst('post-engagement', ['searchtext', 'media-type'], ['uri-id' => $uri_id]);
                if (empty($engagement['searchtext'])) {
-                       Logger::debug('No engagement found', ['uri-id' => $uri_id]);
+                       DI::logger()->debug('No engagement found', ['uri-id' => $uri_id]);
                        return;
                }
 
                $language = !empty($item['language']) ? array_key_first(json_decode($item['language'], true)) : '';
                $tags     = array_column(Tag::getByURIId($uri_id, [Tag::HASHTAG]), 'name');
 
-               Logger::debug('Prepare check', ['uri-id' => $uri_id, 'language' => $language, 'tags' => $tags, 'searchtext' => $engagement['searchtext'], 'media_type' => $engagement['media-type'], 'owner' => $item['owner-id'], 'reshare' => $reshare_id]);
+               DI::logger()->debug('Prepare check', ['uri-id' => $uri_id, 'language' => $language, 'tags' => $tags, 'searchtext' => $engagement['searchtext'], 'media_type' => $engagement['media-type'], 'owner' => $item['owner-id'], 'reshare' => $reshare_id]);
 
                $count = 0;
                foreach (DI::userDefinedChannel()->getMatchingChannelUsers($engagement['searchtext'], $language, $tags, $engagement['media-type'], $item['owner-id'], $reshare_id) as $uid) {
@@ -1547,19 +1546,19 @@ class Item
                                'author-id' => Contact::getPublicIdByUserId($uid), 'uid' => $uid, 'thr-parent-id' => $uri_id
                        ];
                        if (!Post::exists($condition)) {
-                               Logger::debug('Reshare post', ['uid' => $uid, 'uri-id' => $uri_id]);
+                               DI::logger()->debug('Reshare post', ['uid' => $uid, 'uri-id' => $uri_id]);
                                $allow_cid = '';
                                $allow_gid = '<' . Circle::FOLLOWERS . '>';
                                $deny_cid  = '';
                                $deny_gid  = '';
                                self::performActivity($item['id'], 'announce', $uid, $allow_cid, $allow_gid, $deny_cid, $deny_gid);
                        } else {
-                               Logger::debug('Reshare already exists', ['uid' => $uid, 'uri-id' => $uri_id]);
+                               DI::logger()->debug('Reshare already exists', ['uid' => $uid, 'uri-id' => $uri_id]);
                        }
                        $count++;
                }
 
-               Logger::debug('Check done', ['uri-id' => $uri_id, 'count' => $count]);
+               DI::logger()->debug('Check done', ['uri-id' => $uri_id, 'count' => $count]);
        }
 
        /**
@@ -1622,13 +1621,13 @@ class Item
                        ['uri-id' => $item['thr-parent-id'], 'uid' => $item['uid']]
                );
                if (!DBA::isResult($parent)) {
-                       Logger::error('Parent not found', ['uri-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
+                       DI::logger()->error('Parent not found', ['uri-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
                        return;
                }
 
                $author = Contact::selectFirst(['url', 'contact-type', 'network'], ['id' => $item['author-id']]);
                if (!DBA::isResult($author)) {
-                       Logger::error('Author not found', ['id' => $item['author-id']]);
+                       DI::logger()->error('Author not found', ['id' => $item['author-id']]);
                        return;
                }
 
@@ -1637,24 +1636,24 @@ class Item
 
                $cid = Contact::getIdForURL($author['url'], $item['uid']);
                if (empty($cid) || (!Contact::isSharing($cid, $item['uid']) && ($cid != $self))) {
-                       Logger::info('The resharer is not a following contact: quit', ['resharer' => $author['url'], 'uid' => $item['uid'], 'cid' => $cid]);
+                       DI::logger()->info('The resharer is not a following contact: quit', ['resharer' => $author['url'], 'uid' => $item['uid'], 'cid' => $cid]);
                        return;
                }
 
                if ($author['contact-type'] != Contact::TYPE_COMMUNITY) {
                        if ($parent['post-reason'] == self::PR_ANNOUNCEMENT) {
-                               Logger::info('The parent is already marked as announced: quit', ['causer' => $parent['causer-id'], 'owner' => $parent['owner-id'], 'author' => $parent['author-id'], 'uid' => $item['uid']]);
+                               DI::logger()->info('The parent is already marked as announced: quit', ['causer' => $parent['causer-id'], 'owner' => $parent['owner-id'], 'author' => $parent['author-id'], 'uid' => $item['uid']]);
                                return;
                        }
 
                        if (Contact::isSharing($parent['owner-id'], $item['uid'])) {
-                               Logger::info('The resharer is no group: quit', ['resharer' => $item['author-id'], 'owner' => $parent['owner-id'], 'author' => $parent['author-id'], 'uid' => $item['uid']]);
+                               DI::logger()->info('The resharer is no group: quit', ['resharer' => $item['author-id'], 'owner' => $parent['owner-id'], 'author' => $parent['author-id'], 'uid' => $item['uid']]);
                                return;
                        }
                }
 
                self::update(['post-reason' => self::PR_ANNOUNCEMENT, 'causer-id' => $item['author-id']], ['id' => $parent['id']]);
-               Logger::info('Set announcement post-reason', ['uri-id' => $item['uri-id'], 'thr-parent-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
+               DI::logger()->info('Set announcement post-reason', ['uri-id' => $item['uri-id'], 'thr-parent-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
        }
 
        /**
@@ -1680,18 +1679,18 @@ class Item
                                        }
                                }
                                if ($keep) {
-                                       Logger::debug('Wanted languages found', ['uid' => $uid, 'user-languages' => $user_languages, 'item-languages' => $languages]);
+                                       DI::logger()->debug('Wanted languages found', ['uid' => $uid, 'user-languages' => $user_languages, 'item-languages' => $languages]);
                                } else {
-                                       Logger::debug('No wanted languages found', ['uid' => $uid, 'user-languages' => $user_languages, 'item-languages' => $languages]);
+                                       DI::logger()->debug('No wanted languages found', ['uid' => $uid, 'user-languages' => $user_languages, 'item-languages' => $languages]);
                                        continue;
                                }
                        }
 
                        $stored = self::storeForUserByUriId($item['uri-id'], $uid, ['post-reason' => self::PR_TAG]);
-                       Logger::info('Stored item for users', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'stored' => $stored]);
+                       DI::logger()->info('Stored item for users', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'stored' => $stored]);
                        foreach ($tags as $tag) {
                                $stored = Category::storeFileByURIId($item['uri-id'], $uid, Category::SUBCRIPTION, $tag);
-                               Logger::debug('Stored tag subscription for user', ['uri-id' => $item['uri-id'], 'uid' => $uid, $tag, 'stored' => $stored]);
+                               DI::logger()->debug('Stored tag subscription for user', ['uri-id' => $item['uri-id'], 'uid' => $uid, $tag, 'stored' => $stored]);
                        }
                }
        }
@@ -1708,7 +1707,7 @@ class Item
                $condition = ["`id` IN (SELECT `parent` FROM `post-user-view` WHERE `id` = ?)", $itemid];
                $parent = Post::selectFirst(['owner-id'], $condition);
                if (!DBA::isResult($parent)) {
-                       Logger::warning('Item not found', ['condition' => $condition]);
+                       DI::logger()->warning('Item not found', ['condition' => $condition]);
                        return;
                }
 
@@ -1720,7 +1719,7 @@ class Item
                ];
                $item = Post::selectFirst(array_merge(self::ITEM_FIELDLIST, ['protocol']), $condition);
                if (!DBA::isResult($item)) {
-                       Logger::warning('Item not found', ['condition' => $condition]);
+                       DI::logger()->warning('Item not found', ['condition' => $condition]);
                        return;
                }
 
@@ -1803,26 +1802,26 @@ class Item
        public static function storeForUserByUriId(int $uri_id, int $uid, array $fields = [], int $source_uid = 0): int
        {
                if ($uid == $source_uid) {
-                       Logger::warning('target UID must not be be equal to the source UID', ['uri-id' => $uri_id, 'uid' => $uid]);
+                       DI::logger()->warning('target UID must not be be equal to the source UID', ['uri-id' => $uri_id, 'uid' => $uid]);
                        return 0;
                }
 
                $item = Post::selectFirst(array_merge(self::ITEM_FIELDLIST, ['protocol']), ['uri-id' => $uri_id, 'uid' => $source_uid]);
                if (!DBA::isResult($item)) {
-                       Logger::warning('Item could not be fetched', ['uri-id' => $uri_id, 'uid' => $source_uid]);
+                       DI::logger()->warning('Item could not be fetched', ['uri-id' => $uri_id, 'uid' => $source_uid]);
                        return 0;
                }
 
                if (($uid != 0) && ($item['gravity'] == self::GRAVITY_PARENT)) {
                        $owner = User::getOwnerDataById($uid);
                        if (($owner['contact-type'] == User::ACCOUNT_TYPE_COMMUNITY) && !Tag::isMentioned($uri_id, $owner['url'])) {
-                               Logger::info('Target user is a group but is not mentioned here, thread will not be stored', ['uid' => $uid, 'uri-id' => $uri_id]);
+                               DI::logger()->info('Target user is a group but is not mentioned here, thread will not be stored', ['uid' => $uid, 'uri-id' => $uri_id]);
                                return 0;
                        }
                }
 
                if (($source_uid == 0) && (($item['private'] == self::PRIVATE) || !in_array($item['network'], array_merge(Protocol::FEDERATED, [Protocol::BLUESKY])))) {
-                       Logger::notice('Item is private or not from a federated network. It will not be stored for the user.', ['uri-id' => $uri_id, 'uid' => $uid, 'private' => $item['private'], 'network' => $item['network']]);
+                       DI::logger()->notice('Item is private or not from a federated network. It will not be stored for the user.', ['uri-id' => $uri_id, 'uid' => $uid, 'private' => $item['private'], 'network' => $item['network']]);
                        return 0;
                }
 
@@ -1840,7 +1839,7 @@ class Item
                        DI::pConfig()->get($uid, 'system', 'accept_only_sharer') == self::COMPLETION_NONE &&
                        !in_array($item['post-reason'], [self::PR_FOLLOWER, self::PR_TAG, self::PR_TO, self::PR_CC, self::PR_ACTIVITY, self::PR_AUDIENCE])
                ) {
-                       Logger::info('Contact is not a follower, thread will not be stored', ['author' => $item['author-link'], 'uid' => $uid, 'uri-id' => $uri_id, 'post-reason' => $item['post-reason']]);
+                       DI::logger()->info('Contact is not a follower, thread will not be stored', ['author' => $item['author-link'], 'uid' => $uid, 'uri-id' => $uri_id, 'post-reason' => $item['post-reason']]);
                        return 0;
                }
 
@@ -1848,20 +1847,20 @@ class Item
 
                if (($uri_id != $item['parent-uri-id']) && ($item['gravity'] == self::GRAVITY_COMMENT) && !Post::exists(['uri-id' => $item['parent-uri-id'], 'uid' => $uid])) {
                        if (!self::fetchParent($item['parent-uri-id'], $uid, $causer)) {
-                               Logger::info('Parent post had not been added', ['uri-id' => $item['parent-uri-id'], 'uid' => $uid, 'causer' => $causer]);
+                               DI::logger()->info('Parent post had not been added', ['uri-id' => $item['parent-uri-id'], 'uid' => $uid, 'causer' => $causer]);
                                return 0;
                        }
-                       Logger::info('Fetched parent post', ['uri-id' => $item['parent-uri-id'], 'uid' => $uid, 'causer' => $causer]);
+                       DI::logger()->info('Fetched parent post', ['uri-id' => $item['parent-uri-id'], 'uid' => $uid, 'causer' => $causer]);
                } elseif (($uri_id != $item['thr-parent-id']) && $is_reshare && !Post::exists(['uri-id' => $item['thr-parent-id'], 'uid' => $uid])) {
                        if (!self::fetchParent($item['thr-parent-id'], $uid, $causer)) {
-                               Logger::info('Thread parent had not been added', ['uri-id' => $item['thr-parent-id'], 'uid' => $uid, 'causer' => $causer]);
+                               DI::logger()->info('Thread parent had not been added', ['uri-id' => $item['thr-parent-id'], 'uid' => $uid, 'causer' => $causer]);
                                return 0;
                        }
-                       Logger::info('Fetched thread parent', ['uri-id' => $item['thr-parent-id'], 'uid' => $uid, 'causer' => $causer]);
+                       DI::logger()->info('Fetched thread parent', ['uri-id' => $item['thr-parent-id'], 'uid' => $uid, 'causer' => $causer]);
                }
 
                $stored = self::storeForUser($item, $uid);
-               Logger::info('Item stored for user', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'causer' => $causer, 'source-uid' => $source_uid, 'stored' => $stored]);
+               DI::logger()->info('Item stored for user', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'causer' => $causer, 'source-uid' => $source_uid, 'stored' => $stored]);
                return $stored;
        }
 
@@ -1879,7 +1878,7 @@ class Item
                // Fetch the origin user for the post
                $origin_uid = self::GetOriginUidForUriId($uri_id, $uid);
                if (is_null($origin_uid)) {
-                       Logger::info('Origin item was not found', ['uid' => $uid, 'uri-id' => $uri_id]);
+                       DI::logger()->info('Origin item was not found', ['uid' => $uid, 'uri-id' => $uri_id]);
                        return 0;
                }
 
@@ -1955,11 +1954,11 @@ class Item
                                        if (!empty($event)) {
                                                // We aren't using "Event::store" here, since we don't want to trigger any further action
                                                $ret = DBA::update('event', $event, ['id' => $event_post['event-id']]);
-                                               Logger::info('Event updated', ['uid' => $uid, 'source-event' => $item['event-id'], 'target-event' => $event_post['event-id'], 'ret' => $ret]);
+                                               DI::logger()->info('Event updated', ['uid' => $uid, 'source-event' => $item['event-id'], 'target-event' => $event_post['event-id'], 'ret' => $ret]);
                                        }
                                }
                        }
-                       Logger::info('Item already exists', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'id' => $post['id']]);
+                       DI::logger()->info('Item already exists', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'id' => $post['id']]);
                        return $post['id'];
                }
 
@@ -1997,9 +1996,9 @@ class Item
                $distributed = self::insert($item, $notify);
 
                if (!$distributed) {
-                       Logger::info("Distributed item wasn't stored", ['uri-id' => $item['uri-id'], 'user' => $uid]);
+                       DI::logger()->info("Distributed item wasn't stored", ['uri-id' => $item['uri-id'], 'user' => $uid]);
                } else {
-                       Logger::info('Distributed item was stored', ['uri-id' => $item['uri-id'], 'user' => $uid, 'stored' => $distributed]);
+                       DI::logger()->info('Distributed item was stored', ['uri-id' => $item['uri-id'], 'user' => $uid, 'stored' => $distributed]);
                }
                return $distributed;
        }
@@ -2065,7 +2064,7 @@ class Item
 
                        $public_shadow = self::insert($item);
 
-                       Logger::info('Stored public shadow', ['thread' => $itemid, 'id' => $public_shadow]);
+                       DI::logger()->info('Stored public shadow', ['thread' => $itemid, 'id' => $public_shadow]);
                }
        }
 
@@ -2124,7 +2123,7 @@ class Item
 
                $public_shadow = self::insert($item);
 
-               Logger::info('Stored public shadow', ['uri-id' => $item['uri-id'], 'id' => $public_shadow]);
+               DI::logger()->info('Stored public shadow', ['uri-id' => $item['uri-id'], 'id' => $public_shadow]);
 
                // If this was a comment to a Diaspora post we don't get our comment back.
                // This means that we have to distribute the comment by ourselves.
@@ -2194,7 +2193,7 @@ class Item
                        $author = Contact::selectFirst(['about'], ['id' => $author_id]);
                        if (!empty($author['about'])) {
                                $about = BBCode::toSearchText($author['about'], 0);
-                               Logger::debug('About field added', ['author' => $author_id, 'body' => $searchtext, 'about' => $about]);
+                               DI::logger()->debug('About field added', ['author' => $author_id, 'body' => $searchtext, 'about' => $about]);
                                $searchtext .= ' ' . $about;
                        }
                }
@@ -2375,7 +2374,7 @@ class Item
 
                $hostPart = $host ?: $parsed['host'] ?? '';
                if (!$hostPart) {
-                       Logger::warning('Empty host GUID part', ['uri' => $uri, 'host' => $host, 'parsed' => $parsed]);
+                       DI::logger()->warning('Empty host GUID part', ['uri' => $uri, 'host' => $host, 'parsed' => $parsed]);
                }
 
                // Glue it together to be able to make a hash from it
@@ -2560,26 +2559,26 @@ class Item
        {
                $owner = User::getOwnerDataById($uid);
                if (!DBA::isResult($owner)) {
-                       Logger::warning('User not found, quitting here.', ['uid' => $uid]);
+                       DI::logger()->warning('User not found, quitting here.', ['uid' => $uid]);
                        return false;
                }
 
                if ($owner['contact-type'] != User::ACCOUNT_TYPE_COMMUNITY) {
-                       Logger::debug('Owner is no community, quitting here.', ['uid' => $uid, 'id' => $item_id]);
+                       DI::logger()->debug('Owner is no community, quitting here.', ['uid' => $uid, 'id' => $item_id]);
                        return false;
                }
 
                $item = Post::selectFirst(self::ITEM_FIELDLIST, ['id' => $item_id, 'gravity' => [self::GRAVITY_PARENT, self::GRAVITY_COMMENT], 'origin' => false]);
                if (!DBA::isResult($item)) {
-                       Logger::debug('Post is an activity or origin or not found at all, quitting here.', ['id' => $item_id]);
+                       DI::logger()->debug('Post is an activity or origin or not found at all, quitting here.', ['id' => $item_id]);
                        return false;
                }
 
                if ($item['gravity'] == self::GRAVITY_PARENT) {
                        if (Tag::isMentioned($item['uri-id'], $owner['url'])) {
-                               Logger::info('Mention found in tag.', ['uri' => $item['uri'], 'uid' => $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
+                               DI::logger()->info('Mention found in tag.', ['uri' => $item['uri'], 'uid' => $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
                        } else {
-                               Logger::info('Top-level post without mention is deleted.', ['uri' => $item['uri'], $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
+                               DI::logger()->info('Top-level post without mention is deleted.', ['uri' => $item['uri'], $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
                                Post\User::delete(['uri-id' => $item['uri-id'], 'uid' => $item['uid']]);
                                return true;
                        }
@@ -2589,14 +2588,14 @@ class Item
                        Hook::callAll('tagged', $arr);
                } else {
                        if (Tag::isMentioned($item['parent-uri-id'], $owner['url'])) {
-                               Logger::info('Mention found in parent tag.', ['uri' => $item['uri'], 'uid' => $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
+                               DI::logger()->info('Mention found in parent tag.', ['uri' => $item['uri'], 'uid' => $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
                        } else {
-                               Logger::debug('No mentions found in parent, quitting here.', ['id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
+                               DI::logger()->debug('No mentions found in parent, quitting here.', ['id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
                                return false;
                        }
                }
 
-               Logger::info('Community post will be distributed', ['uri' => $item['uri'], 'uid' => $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
+               DI::logger()->info('Community post will be distributed', ['uri' => $item['uri'], 'uid' => $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
 
                if ($owner['page-flags'] == User::PAGE_FLAGS_PRVGROUP) {
                        $allow_cid = '';
@@ -2608,7 +2607,7 @@ class Item
                        self::performActivity($item['id'], 'announce', $uid);
                }
 
-               Logger::info('Community post had been distributed', ['uri' => $item['uri'], 'uid' => $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
+               DI::logger()->info('Community post had been distributed', ['uri' => $item['uri'], 'uid' => $uid, 'id' => $item_id, 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
                return false;
        }
 
@@ -2641,7 +2640,7 @@ class Item
                        return;
                }
 
-               Logger::info('Automatically reshare item', ['uid' => $item['uid'], 'id' => $item['id'], 'guid' => $item['guid'], 'uri-id' => $item['uri-id']]);
+               DI::logger()->info('Automatically reshare item', ['uid' => $item['uid'], 'id' => $item['id'], 'guid' => $item['guid'], 'uri-id' => $item['uri-id']]);
 
                self::performActivity($item['id'], 'announce', $item['uid']);
        }
@@ -2654,34 +2653,34 @@ class Item
 
                // Prevent the forwarding of posts that are forwarded
                if (!empty($datarray['extid']) && ($datarray['extid'] == Protocol::DFRN)) {
-                       Logger::info('Already forwarded');
+                       DI::logger()->info('Already forwarded');
                        return false;
                }
 
                // Prevent to forward already forwarded posts
                if ($datarray['app'] == DI::baseUrl()->getHost()) {
-                       Logger::info('Already forwarded (second test)');
+                       DI::logger()->info('Already forwarded (second test)');
                        return false;
                }
 
                // Only forward posts
                if ($datarray['verb'] != Activity::POST) {
-                       Logger::info('No post');
+                       DI::logger()->info('No post');
                        return false;
                }
 
                if (($contact['network'] != Protocol::FEED) && ($datarray['private'] == self::PRIVATE)) {
-                       Logger::info('Not public');
+                       DI::logger()->info('Not public');
                        return false;
                }
 
                if (User::getById($contact['uid'], ['blocked'])['blocked'] ?? false) {
-                       Logger::info('User is blocked', ['contact' => $contact]);
+                       DI::logger()->info('User is blocked', ['contact' => $contact]);
                        return false;
                }
 
                $datarray2 = $datarray;
-               Logger::info('remote-self start', ['contact' => $contact['url'], 'remote_self' => $contact['remote_self'], 'item' => $datarray]);
+               DI::logger()->info('remote-self start', ['contact' => $contact['url'], 'remote_self' => $contact['remote_self'], 'item' => $datarray]);
 
                $self = DBA::selectFirst(
                        'contact',
@@ -2689,7 +2688,7 @@ class Item
                        ['uid' => $contact['uid'], 'self' => true]
                );
                if (!DBA::isResult($self)) {
-                       Logger::error('Self contact not found', ['uid' => $contact['uid']]);
+                       DI::logger()->error('Self contact not found', ['uid' => $contact['uid']]);
                        return false;
                }
 
@@ -2723,7 +2722,7 @@ class Item
 
                        // Store the original post
                        $result = self::insert($datarray2);
-                       Logger::info('remote-self post original item', ['contact' => $contact['url'], 'result' => $result, 'item' => $datarray2]);
+                       DI::logger()->info('remote-self post original item', ['contact' => $contact['url'], 'result' => $result, 'item' => $datarray2]);
                } else {
                        $datarray['app'] = 'Feed';
                        $result = true;
@@ -2752,7 +2751,7 @@ class Item
                        return $s;
                }
 
-               Logger::info('check for photos');
+               DI::logger()->info('check for photos');
                $site = substr(DI::baseUrl(), strpos(DI::baseUrl(), '://'));
 
                $orig_body = $s;
@@ -2766,7 +2765,7 @@ class Item
                        $img_st_close++; // make it point to AFTER the closing bracket
                        $image = substr($orig_body, $img_start + $img_st_close, $img_len);
 
-                       Logger::info('found photo', ['image' => $image]);
+                       DI::logger()->info('found photo', ['image' => $image]);
 
                        if (stristr($image, $site . '/photo/')) {
                                // Only embed locally hosted photos
@@ -2805,7 +2804,7 @@ class Item
                                                        $photo_img = Photo::getImageForPhoto($photo);
                                                        // If a custom width and height were specified, apply before embedding
                                                        if (preg_match("/\[img\=([0-9]*)x([0-9]*)\]/is", substr($orig_body, $img_start, $img_st_close), $match)) {
-                                                               Logger::info('scaling photo');
+                                                               DI::logger()->info('scaling photo');
 
                                                                $width = intval($match[1]);
                                                                $height = intval($match[2]);
@@ -2816,9 +2815,9 @@ class Item
                                                        $data = $photo_img->asString();
                                                        $type = $photo_img->getType();
 
-                                                       Logger::info('replacing photo');
+                                                       DI::logger()->info('replacing photo');
                                                        $image = 'data:' . $type . ';base64,' . base64_encode($data);
-                                                       Logger::debug('replaced', ['image' => $image]);
+                                                       DI::logger()->debug('replaced', ['image' => $image]);
                                                }
                                        }
                                }
@@ -2968,7 +2967,7 @@ class Item
                        ++$expired;
                }
                DBA::close($items);
-               Logger::notice('Expired', ['user' => $uid, 'days' => $days, 'network' => $network, 'force' => $force, 'expired' => $expired, 'expire items' => $expire_items, 'expire notes' => $expire_notes, 'expire starred' => $expire_starred, 'expire photos' => $expire_photos, 'condition' => $condition]);
+               DI::logger()->notice('Expired', ['user' => $uid, 'days' => $days, 'network' => $network, 'force' => $force, 'expired' => $expired, 'expire items' => $expire_items, 'expire notes' => $expire_notes, 'expire starred' => $expire_starred, 'expire photos' => $expire_photos, 'condition' => $condition]);
                return $expired;
        }
 
@@ -3021,11 +3020,11 @@ class Item
                        return false;
                }
 
-               Logger::notice('Start create activity', ['verb' => $verb, 'item' => $item_id, 'user' => $uid]);
+               DI::logger()->notice('Start create activity', ['verb' => $verb, 'item' => $item_id, 'user' => $uid]);
 
                $item = Post::selectFirst(self::ITEM_FIELDLIST, ['id' => $item_id]);
                if (!DBA::isResult($item)) {
-                       Logger::warning('Post had not been fetched', ['id' => $item_id]);
+                       DI::logger()->warning('Post had not been fetched', ['id' => $item_id]);
                        return false;
                }
 
@@ -3040,7 +3039,7 @@ class Item
                        if (($item['parent-uri-id'] == $item['uri-id']) && !empty($stored)) {
                                $item = Post::selectFirst(self::ITEM_FIELDLIST, ['id' => $stored]);
                                if (!DBA::isResult($item)) {
-                                       Logger::info('Could not fetch just created item - should not happen', ['stored' => $stored, 'uid' => $uid, 'uri-id' => $uri_id]);
+                                       DI::logger()->info('Could not fetch just created item - should not happen', ['stored' => $stored, 'uid' => $uid, 'uri-id' => $uri_id]);
                                        return false;
                                }
                        }
@@ -3049,14 +3048,14 @@ class Item
                // Retrieves the local post owner
                $owner = User::getOwnerDataById($uid);
                if (empty($owner)) {
-                       Logger::info('Empty owner for user', ['uid' => $uid]);
+                       DI::logger()->info('Empty owner for user', ['uid' => $uid]);
                        return false;
                }
 
                // Retrieve the current logged in user's public contact
                $author_id = Contact::getPublicIdByUserId($uid);
                if (empty($author_id)) {
-                       Logger::info('Empty public contact');
+                       DI::logger()->info('Empty public contact');
                        return false;
                }
 
@@ -3091,7 +3090,7 @@ class Item
                                $activity = Activity::ANNOUNCE;
                                break;
                        default:
-                               Logger::warning('unknown verb', ['verb' => $verb, 'item' => $item_id]);
+                               DI::logger()->warning('unknown verb', ['verb' => $verb, 'item' => $item_id]);
                                return false;
                }
 
@@ -4196,10 +4195,10 @@ class Item
         */
        public static function fetchByLink(string $uri, int $uid = 0, int $completion = ActivityPub\Receiver::COMPLETION_MANUAL, string $mimetype = ''): int
        {
-               Logger::info('Trying to fetch link', ['uid' => $uid, 'uri' => $uri]);
+               DI::logger()->info('Trying to fetch link', ['uid' => $uid, 'uri' => $uri]);
                $item_id = self::searchByLink($uri, $uid);
                if (!empty($item_id)) {
-                       Logger::info('Link found', ['uid' => $uid, 'uri' => $uri, 'id' => $item_id]);
+                       DI::logger()->info('Link found', ['uid' => $uid, 'uri' => $uri, 'id' => $item_id]);
                        return $item_id;
                }
 
@@ -4216,7 +4215,7 @@ class Item
                Hook::callAll('item_by_link', $hookData);
 
                if (isset($hookData['item_id'])) {
-                       Logger::info('Hook link fetched', ['uid' => $uid, 'uri' => $uri, 'id' => $hookData['item_id']]);
+                       DI::logger()->info('Hook link fetched', ['uid' => $uid, 'uri' => $uri, 'id' => $hookData['item_id']]);
                        return is_numeric($hookData['item_id']) ? $hookData['item_id'] : 0;
                }
 
@@ -4225,7 +4224,7 @@ class Item
                                $curlResult = DI::httpClient()->head($uri, [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::JSON_AS, HttpClientOptions::REQUEST => HttpClientRequest::ACTIVITYPUB]);
                                $mimetype = $curlResult->getContentType();
                        } catch (\Throwable $th) {
-                               Logger::info('Error while fetching HTTP link via HEAD', ['uid' => $uid, 'uri' => $uri, 'code' => $th->getCode(), 'message' => $th->getMessage()]);
+                               DI::logger()->info('Error while fetching HTTP link via HEAD', ['uid' => $uid, 'uri' => $uri, 'code' => $th->getCode(), 'message' => $th->getMessage()]);
                                return 0;
                        }
                }
@@ -4236,7 +4235,7 @@ class Item
                                $curlResult = HTTPSignature::fetchRaw($uri, $uid);
                                $mimetype = $curlResult->getContentType();
                        } catch (\Throwable $th) {
-                               Logger::info('Error while fetching HTTP link via signed GET', ['uid' => $uid, 'uri' => $uri, 'code' => $th->getCode(), 'message' => $th->getMessage()]);
+                               DI::logger()->info('Error while fetching HTTP link via signed GET', ['uid' => $uid, 'uri' => $uri, 'code' => $th->getCode(), 'message' => $th->getMessage()]);
                                return 0;
                        }
                }
@@ -4246,7 +4245,7 @@ class Item
                        if (!empty($fetched_uri)) {
                                $item_id = self::searchByLink($fetched_uri, $uid);
                                if ($item_id) {
-                                       Logger::info('ActivityPub link fetched', ['uid' => $uid, 'uri' => $uri, 'id' => $item_id]);
+                                       DI::logger()->info('ActivityPub link fetched', ['uid' => $uid, 'uri' => $uri, 'id' => $item_id]);
                                        return $item_id;
                                }
                        }
@@ -4254,18 +4253,18 @@ class Item
 
                $item_id = Diaspora::fetchByURL($uri);
                if ($item_id) {
-                       Logger::info('Diaspora link fetched', ['uid' => $uid, 'uri' => $uri, 'id' => $item_id]);
+                       DI::logger()->info('Diaspora link fetched', ['uid' => $uid, 'uri' => $uri, 'id' => $item_id]);
                        return $item_id;
                }
 
-               Logger::info('This is not an item link', ['uid' => $uid, 'uri' => $uri]);
+               DI::logger()->info('This is not an item link', ['uid' => $uid, 'uri' => $uri]);
                return 0;
        }
 
        /**
         * Fetch the uri-id of a quoted post by searching for data in the body or attached media
         *
-        * @param string $body   The body of the 
+        * @param string $body   The body of the
         * @param int    $uid    The id of the user
         * @return integer
         */
@@ -4277,14 +4276,14 @@ class Item
                }
 
                if (empty($shared['link']) && empty($shared['message_id'])) {
-                       Logger::notice('Invalid share block.', ['share' => $shared]);
+                       DI::logger()->notice('Invalid share block.', ['share' => $shared]);
                        return 0;
                }
 
                if (!empty($shared['guid'])) {
                        $shared_item = Post::selectFirst(['uri-id'], ['guid' => $shared['guid'], 'uid' => [0, $uid]]);
                        if (!empty($shared_item['uri-id'])) {
-                               Logger::debug('Found post by guid', ['guid' => $shared['guid'], 'uid' => $uid]);
+                               DI::logger()->debug('Found post by guid', ['guid' => $shared['guid'], 'uid' => $uid]);
                                return $shared_item['uri-id'];
                        }
                }
@@ -4292,7 +4291,7 @@ class Item
                if (!empty($shared['message_id'])) {
                        $shared_item = Post::selectFirst(['uri-id'], ['uri' => $shared['message_id'], 'uid' => [0, $uid]]);
                        if (!empty($shared_item['uri-id'])) {
-                               Logger::debug('Found post by message_id', ['message_id' => $shared['message_id'], 'uid' => $uid]);
+                               DI::logger()->debug('Found post by message_id', ['message_id' => $shared['message_id'], 'uid' => $uid]);
                                return $shared_item['uri-id'];
                        }
                }
@@ -4300,7 +4299,7 @@ class Item
                if (!empty($shared['link'])) {
                        $shared_item = Post::selectFirst(['uri-id'], ['plink' => $shared['link'], 'uid' => [0, $uid]]);
                        if (!empty($shared_item['uri-id'])) {
-                               Logger::debug('Found post by link', ['link' => $shared['link'], 'uid' => $uid]);
+                               DI::logger()->debug('Found post by link', ['link' => $shared['link'], 'uid' => $uid]);
                                return $shared_item['uri-id'];
                        }
                }
@@ -4308,17 +4307,17 @@ class Item
                $url = $shared['message_id'] ?: $shared['link'];
                $id = self::fetchByLink($url, 0, ActivityPub\Receiver::COMPLETION_ASYNC);
                if (!$id) {
-                       Logger::notice('Post could not be fetched.', ['url' => $url, 'uid' => $uid]);
+                       DI::logger()->notice('Post could not be fetched.', ['url' => $url, 'uid' => $uid]);
                        return 0;
                }
 
                $shared_item = Post::selectFirst(['uri-id'], ['id' => $id]);
                if (!empty($shared_item['uri-id'])) {
-                       Logger::debug('Fetched shared post', ['id' => $id, 'url' => $url, 'uid' => $uid]);
+                       DI::logger()->debug('Fetched shared post', ['id' => $id, 'url' => $url, 'uid' => $uid]);
                        return $shared_item['uri-id'];
                }
 
-               Logger::warning('Post does not exist although it was supposed to had been fetched.', ['id' => $id, 'url' => $url, 'uid' => $uid]);
+               DI::logger()->warning('Post does not exist although it was supposed to had been fetched.', ['id' => $id, 'url' => $url, 'uid' => $uid]);
                return 0;
        }
 
index cd13f8903324741dd403183841f545ffc2d837f9..57b5b841a76f522b73e0874b811f021b6c99c0e0 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Model;
 
-use Friendica\Core\Logger;
 use Friendica\Database\Database;
 use Friendica\Database\DBA;
 use Friendica\DI;
@@ -32,7 +31,7 @@ class ItemURI
                $itemuri = DBA::selectFirst('item-uri', ['id', 'guid'], ['uri' => $fields['uri']]);
                if (!DBA::isResult($itemuri)) {
                        // This shouldn't happen
-                       Logger::warning('Item-uri not found', $fields);
+                       DI::logger()->warning('Item-uri not found', $fields);
                        return null;
                }
 
index e417e3c15dc0da3e76e77c929e15211ce47eb5c0..84542d33e28f9c207b56b3211a59cbe1a27f5916 100644 (file)
@@ -8,7 +8,6 @@
 namespace Friendica\Model;
 
 use Friendica\Core\ACL;
-use Friendica\Core\Logger;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
@@ -58,7 +57,7 @@ class Mail
 
                if (DBA::exists('mail', ['uri' => $msg['uri'], 'uid' => $msg['uid']])) {
                        DBA::unlock();
-                       Logger::info('duplicate message already delivered.');
+                       DI::logger()->info('duplicate message already delivered.');
                        return false;
                }
 
@@ -94,7 +93,7 @@ class Mail
 
                        DI::notify()->createFromArray($notif_params);
 
-                       Logger::info('Mail is processed, notification was sent.', ['id' => $msg['id'], 'uri' => $msg['uri']]);
+                       DI::logger()->info('Mail is processed, notification was sent.', ['id' => $msg['id'], 'uri' => $msg['uri']]);
                }
 
                return $msg['id'];
@@ -170,7 +169,7 @@ class Mail
                }
 
                if (!$convid) {
-                       Logger::warning('conversation not found.');
+                       DI::logger()->warning('conversation not found.');
                        return -4;
                }
 
index 857802d305aa88802cd709148947cbdff1806791..c2757539601ca9bf866589fb56cd11bd23ac05b4 100644 (file)
@@ -8,7 +8,6 @@
 namespace Friendica\Model;
 
 use Friendica\Core\Cache\Enum\Duration;
-use Friendica\Core\Logger;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\DI;
@@ -583,7 +582,7 @@ class Photo
                $photo_failure = false;
 
                if (!Network::isValidHttpUrl($image_url)) {
-                       Logger::warning('Invalid image url', ['image_url' => $image_url, 'uid' => $uid, 'cid' => $cid]);
+                       DI::logger()->warning('Invalid image url', ['image_url' => $image_url, 'uid' => $uid, 'cid' => $cid]);
                        return false;
                }
 
@@ -592,10 +591,10 @@ class Photo
                        try {
                                $ret = DI::httpClient()->get($image_url, HttpClientAccept::IMAGE, [HttpClientOptions::REQUEST => HttpClientRequest::MEDIAPROXY]);
                        } 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 false;
                        }
-                       Logger::debug('Got picture', ['Content-Type' => $ret->getHeader('Content-Type'), 'url' => $image_url]);
+                       DI::logger()->debug('Got picture', ['Content-Type' => $ret->getHeader('Content-Type'), 'url' => $image_url]);
                        $img_str = $ret->getBodyString();
                        $type    = $ret->getContentType();
                } else {
@@ -615,24 +614,24 @@ class Photo
                        $maximagesize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize'));
 
                        if ($maximagesize && ($filesize > $maximagesize)) {
-                               Logger::info('Avatar exceeds image limit', ['uid' => $uid, 'cid' => $cid, 'maximagesize' => $maximagesize, 'size' => $filesize, 'type' => $image->getType()]);
+                               DI::logger()->info('Avatar exceeds image limit', ['uid' => $uid, 'cid' => $cid, 'maximagesize' => $maximagesize, 'size' => $filesize, 'type' => $image->getType()]);
                                if ($image->getImageType() == IMAGETYPE_GIF) {
                                        $image->toStatic();
                                        $image = new Image($image->asString(), image_type_to_mime_type(IMAGETYPE_PNG));
 
                                        $filesize = strlen($image->asString());
-                                       Logger::info('Converted gif to a static png', ['uid' => $uid, 'cid' => $cid, 'size' => $filesize, 'type' => $image->getType()]);
+                                       DI::logger()->info('Converted gif to a static png', ['uid' => $uid, 'cid' => $cid, 'size' => $filesize, 'type' => $image->getType()]);
                                }
                                if ($filesize > $maximagesize) {
                                        foreach ([160, 80] as $pixels) {
                                                if ($filesize > $maximagesize) {
-                                                       Logger::info('Resize', ['uid' => $uid, 'cid' => $cid, 'size' => $filesize, 'max' => $maximagesize, 'pixels' => $pixels, 'type' => $image->getType()]);
+                                                       DI::logger()->info('Resize', ['uid' => $uid, 'cid' => $cid, 'size' => $filesize, 'max' => $maximagesize, 'pixels' => $pixels, 'type' => $image->getType()]);
                                                        $image->scaleDown($pixels);
                                                        $filesize = strlen($image->asString());
                                                }
                                        }
                                }
-                               Logger::info('Avatar is resized', ['uid' => $uid, 'cid' => $cid, 'size' => $filesize, 'type' => $image->getType()]);
+                               DI::logger()->info('Avatar is resized', ['uid' => $uid, 'cid' => $cid, 'size' => $filesize, 'type' => $image->getType()]);
                        }
 
                        $r = self::store($image, $uid, $cid, $resource_id, $filename, self::CONTACT_PHOTOS, 4, self::CONTACT_AVATAR);
@@ -869,9 +868,9 @@ class Photo
                        if (!self::exists($condition)) {
                                $photo = self::selectFirst(['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'uid'], ['resource-id' => $image_rid]);
                                if (!DBA::isResult($photo)) {
-                                       Logger::info('Image not found', ['resource-id' => $image_rid]);
+                                       DI::logger()->info('Image not found', ['resource-id' => $image_rid]);
                                } else {
-                                       Logger::info('Mismatching permissions', ['condition' => $condition, 'photo' => $photo]);
+                                       DI::logger()->info('Mismatching permissions', ['condition' => $condition, 'photo' => $photo]);
                                }
                                continue;
                        }
@@ -910,7 +909,7 @@ class Photo
                ];
 
                $condition = ['resource-id' => $image_rid, 'uid' => $uid];
-               Logger::info('Set permissions', ['condition' => $condition, 'permissions' => $fields]);
+               DI::logger()->info('Set permissions', ['condition' => $condition, 'permissions' => $fields]);
                self::update($fields, $condition);
        }
 
@@ -1010,7 +1009,7 @@ class Photo
                        // Scale down to multiples of 640 until the maximum size isn't exceeded anymore
                        foreach ([5120, 2560, 1280, 640, 320] as $pixels) {
                                if (($filesize > $maximagesize) && (max($width, $height) > $pixels)) {
-                                       Logger::info('Resize', ['size' => $filesize, 'width' => $width, 'height' => $height, 'max' => $maximagesize, 'pixels' => $pixels]);
+                                       DI::logger()->info('Resize', ['size' => $filesize, 'width' => $width, 'height' => $height, 'max' => $maximagesize, 'pixels' => $pixels]);
                                        $image->scaleDown($pixels);
                                        $filesize = strlen($image->asString());
                                        $width    = $image->getWidth();
@@ -1033,7 +1032,7 @@ class Photo
                $max_length = DI::config()->get('system', 'max_image_length');
                if ($max_length > 0) {
                        $image->scaleDown($max_length);
-                       Logger::info('File upload: Scaling picture to new size', ['max-length' => $max_length]);
+                       DI::logger()->info('File upload: Scaling picture to new size', ['max-length' => $max_length]);
                }
 
                return self::resizeToFileSize($image, Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')));
@@ -1052,10 +1051,10 @@ class Photo
                        try {
                                $ret = DI::httpClient()->get($image_url, HttpClientAccept::IMAGE, [HttpClientOptions::REQUEST => HttpClientRequest::MEDIAPROXY]);
                        } 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 [];
                        }
-                       Logger::debug('Got picture', ['Content-Type' => $ret->getHeader('Content-Type'), 'url' => $image_url]);
+                       DI::logger()->debug('Got picture', ['Content-Type' => $ret->getHeader('Content-Type'), 'url' => $image_url]);
                        $img_str = $ret->getBodyString();
                        $type    = $ret->getContentType();
                } else {
@@ -1064,7 +1063,7 @@ class Photo
                }
 
                if (empty($img_str)) {
-                       Logger::notice('Empty content');
+                       DI::logger()->notice('Empty content');
                        return [];
                }
 
@@ -1086,10 +1085,10 @@ class Photo
         */
        private static function uploadImage(array $files): array
        {
-               Logger::info('starting new upload');
+               DI::logger()->info('starting new upload');
 
                if (empty($files)) {
-                       Logger::notice('Empty upload file');
+                       DI::logger()->notice('Empty upload file');
                        return [];
                }
 
@@ -1134,16 +1133,16 @@ class Photo
                }
 
                if (empty($src)) {
-                       Logger::notice('No source file name', ['files' => $files]);
+                       DI::logger()->notice('No source file name', ['files' => $files]);
                        return [];
                }
 
-               Logger::info('File upload', ['src' => $src, 'filename' => $filename, 'size' => $filesize, 'type' => $filetype]);
+               DI::logger()->info('File upload', ['src' => $src, 'filename' => $filename, 'size' => $filesize, 'type' => $filetype]);
 
                $imagedata = @file_get_contents($src);
                $image     = new Image($imagedata, $filetype, $filename);
                if (!$image->isValid()) {
-                       Logger::notice('Image is unvalid', ['files' => $files]);
+                       DI::logger()->notice('Image is unvalid', ['files' => $files]);
                        return [];
                }
 
@@ -1177,13 +1176,13 @@ class Photo
        {
                $user = User::getOwnerDataById($uid);
                if (empty($user)) {
-                       Logger::notice('User not found', ['uid' => $uid]);
+                       DI::logger()->notice('User not found', ['uid' => $uid]);
                        return [];
                }
 
                $data = self::uploadImage($files);
                if (empty($data)) {
-                       Logger::info('upload failed');
+                       DI::logger()->info('upload failed');
                        return [];
                }
 
@@ -1201,14 +1200,14 @@ class Photo
 
                $preview = self::storeWithPreview($image, $user['uid'], $resource_id, $filename, $filesize, $album, $desc, $allow_cid, $allow_gid, $deny_cid, $deny_gid);
                if ($preview < 0) {
-                       Logger::warning('Photo could not be stored', ['uid' => $user['uid'], 'resource_id' => $resource_id, 'filename' => $filename, 'album' => $album]);
+                       DI::logger()->warning('Photo could not be stored', ['uid' => $user['uid'], 'resource_id' => $resource_id, 'filename' => $filename, 'album' => $album]);
                        return [];
                }
 
                $condition = ['resource-id' => $resource_id];
                $photo     = self::selectFirst(['id', 'datasize', 'width', 'height', 'type'], $condition, ['order' => ['width' => true]]);
                if (empty($photo)) {
-                       Logger::notice('Photo not found', ['condition' => $condition]);
+                       DI::logger()->notice('Photo not found', ['condition' => $condition]);
                        return [];
                }
 
@@ -1224,7 +1223,7 @@ class Photo
                $picture['picture']     = DI::baseUrl() . '/photo/' . $resource_id . '-0.' . $image->getExt();
                $picture['preview']     = DI::baseUrl() . '/photo/' . $resource_id . '-' . $preview . '.' . $image->getExt();
 
-               Logger::info('upload done', ['picture' => $picture]);
+               DI::logger()->info('upload done', ['picture' => $picture]);
                return $picture;
        }
 
@@ -1256,7 +1255,7 @@ class Photo
 
                $result = self::store($image, $uid, 0, $resource_id, $filename, $album, 0, self::DEFAULT, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $description);
                if (!$result) {
-                       Logger::warning('Photo could not be stored', ['uid' => $uid, 'resource_id' => $resource_id, 'filename' => $filename, 'album' => $album]);
+                       DI::logger()->warning('Photo could not be stored', ['uid' => $uid, 'resource_id' => $resource_id, 'filename' => $filename, 'album' => $album]);
                        return -1;
                }
 
@@ -1291,17 +1290,17 @@ class Photo
                if (!empty($files)) {
                        $data = self::uploadImage($files);
                        if (empty($data)) {
-                               Logger::info('upload failed');
+                               DI::logger()->info('upload failed');
                                return '';
                        }
                } elseif (!empty($url)) {
                        $data = self::loadImageFromURL($url);
                        if (empty($data)) {
-                               Logger::info('loading from external url failed');
+                               DI::logger()->info('loading from external url failed');
                                return '';
                        }
                } else {
-                       Logger::info('Neither files nor url provided');
+                       DI::logger()->info('Neither files nor url provided');
                        return '';
                }
 
@@ -1314,7 +1313,7 @@ class Photo
                $album       = DI::l10n()->t(self::PROFILE_PHOTOS);
 
                // upload profile image (scales 4, 5, 6)
-               logger::info('starting new profile image upload');
+               DI::logger()->info('starting new profile image upload');
 
                if ($width > 300 || $height > 300) {
                        $image->scaleDown(300);
@@ -1322,7 +1321,7 @@ class Photo
 
                $r = self::store($image, $uid, 0, $resource_id, $filename, $album, 4, self::USER_AVATAR);
                if (!$r) {
-                       logger::warning('profile image upload with scale 4 (300) failed', ['uid' => $uid, 'resource_id' => $resource_id, 'filename' => $filename, 'album' => $album]);
+                       DI::logger()->warning('profile image upload with scale 4 (300) failed', ['uid' => $uid, 'resource_id' => $resource_id, 'filename' => $filename, 'album' => $album]);
                }
 
                if ($width > 80 || $height > 80) {
@@ -1331,7 +1330,7 @@ class Photo
 
                $r = self::store($image, $uid, 0, $resource_id, $filename, $album, 5, self::USER_AVATAR);
                if (!$r) {
-                       logger::warning('profile image upload with scale 5 (80) failed', ['uid' => $uid, 'resource_id' => $resource_id, 'filename' => $filename, 'album' => $album]);
+                       DI::logger()->warning('profile image upload with scale 5 (80) failed', ['uid' => $uid, 'resource_id' => $resource_id, 'filename' => $filename, 'album' => $album]);
                }
 
                if ($width > 48 || $height > 48) {
@@ -1340,10 +1339,10 @@ class Photo
 
                $r = self::store($image, $uid, 0, $resource_id, $filename, $album, 6, self::USER_AVATAR);
                if (!$r) {
-                       logger::warning('profile image upload with scale 6 (48) failed', ['uid' => $uid, 'resource_id' => $resource_id, 'filename' => $filename, 'album' => $album]);
+                       DI::logger()->warning('profile image upload with scale 6 (48) failed', ['uid' => $uid, 'resource_id' => $resource_id, 'filename' => $filename, 'album' => $album]);
                }
 
-               logger::info('new profile image upload ended');
+               DI::logger()->info('new profile image upload ended');
 
                $condition = ["`profile` AND `resource-id` != ? AND `uid` = ?", $resource_id, $uid];
                self::update(['profile' => false, 'photo-type' => self::DEFAULT], $condition);
@@ -1369,17 +1368,17 @@ class Photo
                if (!empty($files)) {
                        $data = self::uploadImage($files);
                        if (empty($data)) {
-                               Logger::info('upload failed');
+                               DI::logger()->info('upload failed');
                                return '';
                        }
                } elseif (!empty($url)) {
                        $data = self::loadImageFromURL($url);
                        if (empty($data)) {
-                               Logger::info('loading from external url failed');
+                               DI::logger()->info('loading from external url failed');
                                return '';
                        }
                } else {
-                       Logger::info('Neither files nor url provided');
+                       DI::logger()->info('Neither files nor url provided');
                        return '';
                }
 
@@ -1397,10 +1396,10 @@ class Photo
 
                $r = self::store($image, $uid, 0, $resource_id, $filename, $album, 3, self::USER_BANNER);
                if (!$r) {
-                       logger::warning('profile banner upload with scale 3 (960) failed');
+                       DI::logger()->warning('profile banner upload with scale 3 (960) failed');
                }
 
-               logger::info('new profile banner upload ended', ['uid' => $uid, 'resource_id' => $resource_id, 'filename' => $filename]);
+               DI::logger()->info('new profile banner upload ended', ['uid' => $uid, 'resource_id' => $resource_id, 'filename' => $filename]);
 
                $condition = ["`photo-type` = ? AND `resource-id` != ? AND `uid` = ?", self::USER_BANNER, $resource_id, $uid];
                self::update(['photo-type' => self::DEFAULT], $condition);
index a8c9d32c07c4fd495ee8a9f81707aa25dfb7db56..3732d0d6962082992ee354540ca1aef17d5ce017 100644 (file)
@@ -13,7 +13,6 @@ use Friendica\Content\Text\BBCode;
 use Friendica\Content\Widget\ContactBlock;
 use Friendica\Core\Cache\Enum\Duration;
 use Friendica\Core\Hook;
-use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\Core\Search;
@@ -202,7 +201,7 @@ class Profile
        {
                $profile = User::getOwnerDataByNick($nickname);
                if (!isset($profile['account_removed']) || $profile['account_removed']) {
-                       Logger::info('profile error: ' . DI::args()->getQueryString());
+                       DI::logger()->info('profile error: ' . DI::args()->getQueryString());
                        return [];
                }
 
@@ -433,7 +432,7 @@ class Profile
                $p['url'] = Contact::magicLinkById($cid, $profile['url']);
 
                if (!isset($profile['hidewall'])) {
-                       Logger::warning('Missing hidewall key in profile array', ['profile' => $profile]);
+                       DI::logger()->warning('Missing hidewall key in profile array', ['profile' => $profile]);
                }
 
                if ($profile['account-type'] == Contact::TYPE_COMMUNITY) {
index be18a1af78b01a93cb5fdfe07acff3b76d2277b5..d07a0aa411b217de04ac06f3b2f34f3a5f03f0cc 100644 (file)
@@ -7,13 +7,11 @@
 
 namespace Friendica\Model;
 
-use Friendica\Core\Logger;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Factory\Api\Mastodon\Notification as NotificationFactory;
 use Friendica\Navigation\Notifications\Entity\Notification as NotificationEntity;
-use Friendica\Object\Api\Mastodon\Notification;
 use Minishlink\WebPush\VAPID;
 
 class Subscription
@@ -133,7 +131,7 @@ class Subscription
 
                $subscriptions = DBA::select('subscription', [], ['uid' => $notification->uid, $type => true]);
                while ($subscription = DBA::fetch($subscriptions)) {
-                       Logger::info('Push notification', ['id' => $subscription['id'], 'uid' => $subscription['uid'], 'type' => $type]);
+                       DI::logger()->info('Push notification', ['id' => $subscription['id'], 'uid' => $subscription['uid'], 'type' => $type]);
                        Worker::add(Worker::PRIORITY_HIGH, 'PushSubscription', $subscription['id'], $notification->id);
                }
                DBA::close($subscriptions);
index 07767b4991952cb6ef3985f2a4300a233a0018ea..e5182a537923cb5b24053bbe4e6509ad3fabcd2f 100644 (file)
@@ -9,7 +9,6 @@ namespace Friendica\Model;
 
 use Friendica\Content\Text\BBCode;
 use Friendica\Core\Cache\Enum\Duration;
-use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Database\Database;
 use Friendica\Database\DBA;
@@ -101,11 +100,11 @@ class Tag
                        }
 
                        if ((substr($url, 0, 7) == 'https//') || (substr($url, 0, 6) == 'http//')) {
-                               Logger::notice('Wrong scheme in url', ['url' => $url]);
+                               DI::logger()->notice('Wrong scheme in url', ['url' => $url]);
                        }
 
                        $cid = Contact::getIdForURL($url, 0, false);
-                       Logger::debug('Got id for contact', ['cid' => $cid, 'url' => $url]);
+                       DI::logger()->debug('Got id for contact', ['cid' => $cid, 'url' => $url]);
 
                        if (empty($cid)) {
                                $tag = DBA::selectFirst('tag', ['name', 'type'], ['url' => $url]);
@@ -141,14 +140,14 @@ class Tag
                        $condition = $fields;
                        $condition['type'] = [self::MENTION, self::EXCLUSIVE_MENTION, self::IMPLICIT_MENTION];
                        if (DBA::exists('post-tag', $condition)) {
-                               Logger::info('Tag already exists', $fields);
+                               DI::logger()->info('Tag already exists', $fields);
                                return;
                        }
                }
 
                DBA::insert('post-tag', $fields, Database::INSERT_IGNORE);
 
-               Logger::debug('Stored tag/mention', ['uri-id' => $uriId, 'tag-id' => $tagid, 'contact-id' => $cid, 'name' => $name, 'type' => $type]);
+               DI::logger()->debug('Stored tag/mention', ['uri-id' => $uriId, 'tag-id' => $tagid, 'contact-id' => $cid, 'name' => $name, 'type' => $type]);
        }
 
        /**
@@ -170,26 +169,26 @@ class Tag
                if (!empty($tag['type'])) {
                        $target = $tag['type'];
                        if ($target != self::GENERAL_COLLECTION) {
-                               Logger::debug('Found existing type', ['type' => $tag['type'], 'url' => $url]);
+                               DI::logger()->debug('Found existing type', ['type' => $tag['type'], 'url' => $url]);
                                return $target;
                        }
                }
 
                if ($url == ActivityPub::PUBLIC_COLLECTION) {
                        $target = self::PUBLIC_COLLECTION;
-                       Logger::debug('Public collection', ['url' => $url]);
+                       DI::logger()->debug('Public collection', ['url' => $url]);
                } else {
                        if (DBA::exists('apcontact', ['followers' => $url])) {
                                $target = self::FOLLOWER_COLLECTION;
-                               Logger::debug('Found collection via existing apcontact', ['url' => $url]);
+                               DI::logger()->debug('Found collection via existing apcontact', ['url' => $url]);
                        } elseif (Contact::getIdForURL($url, 0, $fetch ? null : false)) {
                                $target = self::ACCOUNT;
-                               Logger::debug('URL is an account', ['url' => $url]);
+                               DI::logger()->debug('URL is an account', ['url' => $url]);
                        } elseif ($fetch && ($target != self::GENERAL_COLLECTION)) {
                                $content = HTTPSignature::fetch($url);
                                if (!empty($content['type']) && ($content['type'] == 'OrderedCollection')) {
                                        $target = self::GENERAL_COLLECTION;
-                                       Logger::debug('URL is an ordered collection', ['url' => $url]);
+                                       DI::logger()->debug('URL is an ordered collection', ['url' => $url]);
                                }
                        }
                }
@@ -199,7 +198,7 @@ class Tag
                }
 
                if (empty($target)) {
-                       Logger::debug('No type could be detected', ['url' => $url]);
+                       DI::logger()->debug('No type could be detected', ['url' => $url]);
                }
 
                return $target;
@@ -238,7 +237,7 @@ class Tag
                // Also log type
                $fields['type'] = $type;
 
-               Logger::error('No tag id created', $fields);
+               DI::logger()->error('No tag id created', $fields);
                return 0;
        }
 
@@ -305,7 +304,7 @@ class Tag
         */
        public static function storeFromArray(array $item, string $tags = null)
        {
-               Logger::info('Check for tags', ['uri-id' => $item['uri-id'], 'hash' => $tags]);
+               DI::logger()->info('Check for tags', ['uri-id' => $item['uri-id'], 'hash' => $tags]);
 
                if (is_null($tags)) {
                        $tags = self::TAG_CHARACTER[self::HASHTAG] . self::TAG_CHARACTER[self::MENTION] . self::TAG_CHARACTER[self::EXCLUSIVE_MENTION];
@@ -336,14 +335,14 @@ class Tag
         */
        public static function storeRawTagsFromBody(int $uriId, string $body)
        {
-               Logger::info('Check for tags', ['uri-id' => $uriId]);
+               DI::logger()->info('Check for tags', ['uri-id' => $uriId]);
 
                $result = BBCode::getTags($body);
                if (empty($result)) {
                        return;
                }
 
-               Logger::info('Found tags', ['uri-id' => $uriId, 'result' => $result]);
+               DI::logger()->info('Found tags', ['uri-id' => $uriId, 'result' => $result]);
 
                foreach ($result as $tag) {
                        if (substr($tag, 0, 1) != self::TAG_CHARACTER[self::HASHTAG]) {
@@ -397,7 +396,7 @@ class Tag
                        return;
                }
 
-               Logger::debug('Removing tag/mention', ['uri-id' => $uriId, 'tid' => $tag['tid'], 'name' => $name, 'url' => $url]);
+               DI::logger()->debug('Removing tag/mention', ['uri-id' => $uriId, 'tid' => $tag['tid'], 'name' => $name, 'url' => $url]);
                DBA::delete('post-tag', ['uri-id' => $uriId, 'type' => $type, 'tid' => $tag['tid'], 'cid' => $tag['cid']]);
        }
 
@@ -576,7 +575,7 @@ class Tag
                                        break;
 
                                default:
-                                       Logger::warning('Unknown tag type found', $tag);
+                                       DI::logger()->warning('Unknown tag type found', $tag);
                        }
                }
                DBA::close($taglist);
@@ -832,7 +831,7 @@ class Tag
                foreach (self::getByURIId($uriId, [self::HASHTAG]) as $tag) {
                        foreach (self::getUIDListByTag(self::TAG_CHARACTER[self::HASHTAG] . $tag['name']) as $uid) {
                                $uids[$uid][] = $tag['name'];
-                       } 
+                       }
                }
 
                return $uids;
index f837146c8b2a04bbe5f4cddb60017152d81d4bf4..e8b3060b2a4bf37358eed8e1684a516d512f80ff 100644 (file)
@@ -15,7 +15,6 @@ use Friendica\App;
 use Friendica\Content\Pager;
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
-use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\Search;
 use Friendica\Core\System;
@@ -857,7 +856,7 @@ class User
                        $fields['login_date'] = DateTimeFormat::utcNow();
                }
 
-               Logger::debug('Set last activity for user', ['uid' => $user['uid'], 'fields' => $fields]);
+               DI::logger()->debug('Set last activity for user', ['uid' => $user['uid'], 'fields' => $fields]);
                self::update($fields, $user['uid']);
                // Set the last activity for all identities of the user
                DBA::update('user', $fields, ['parent-uid' => $user['uid'], 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]);
@@ -898,7 +897,7 @@ class User
 
                        return $passwordExposedChecker->passwordExposed($password) === PasswordExposed\Enums\PasswordStatus::EXPOSED;
                } catch (Exception $e) {
-                       Logger::error('Password Exposed Exception: ' . $e->getMessage(), [
+                       DI::logger()->error('Password Exposed Exception: ' . $e->getMessage(), [
                                'code' => $e->getCode(),
                                'file' => $e->getFile(),
                                'line' => $e->getLine(),
@@ -1246,7 +1245,7 @@ class User
                $username_max_length = max(1, min(64, intval(DI::config()->get('system', 'username_max_length', 48))));
 
                if ($username_min_length > $username_max_length) {
-                       Logger::error(DI::l10n()->t('system.username_min_length (%s) and system.username_max_length (%s) are excluding each other, swapping values.', $username_min_length, $username_max_length));
+                       DI::logger()->error(DI::l10n()->t('system.username_min_length (%s) and system.username_max_length (%s) are excluding each other, swapping values.', $username_min_length, $username_max_length));
                        $tmp = $username_min_length;
                        $username_min_length = $username_max_length;
                        $username_max_length = $tmp;
@@ -1409,7 +1408,7 @@ class User
                        try {
                                $curlResult = DI::httpClient()->get($photo, HttpClientAccept::IMAGE, [HttpClientOptions::REQUEST => HttpClientRequest::CONTENTTYPE]);
                                if ($curlResult->isSuccess()) {
-                                       Logger::debug('Got picture', ['Content-Type' => $curlResult->getHeader('Content-Type'), 'url' => $photo]);
+                                       DI::logger()->debug('Got picture', ['Content-Type' => $curlResult->getHeader('Content-Type'), 'url' => $photo]);
                                        $img_str = $curlResult->getBodyString();
                                        $type = $curlResult->getContentType();
                                } else {
@@ -1417,7 +1416,7 @@ class User
                                        $type = '';
                                }
                        } catch (\Throwable $th) {
-                               Logger::notice('Got exception', ['code' => $th->getCode(), 'message' => $th->getMessage()]);
+                               DI::logger()->notice('Got exception', ['code' => $th->getCode(), 'message' => $th->getMessage()]);
                                $img_str = '';
                                $type = '';
                        }
@@ -1777,7 +1776,7 @@ class User
                        throw new \InvalidArgumentException('uid needs to be greater than 0');
                }
 
-               Logger::notice('Removing user', ['user' => $uid]);
+               DI::logger()->notice('Removing user', ['user' => $uid]);
 
                $user = self::getById($uid);
                if (!$user) {
@@ -2086,19 +2085,19 @@ class User
 
                $register_policy = DI::config()->get('config', 'register_policy');
                if (!in_array($register_policy, [Module\Register::OPEN, Module\Register::CLOSED])) {
-                       Logger::debug('Unsupported register policy.', ['policy' => $register_policy]);
+                       DI::logger()->debug('Unsupported register policy.', ['policy' => $register_policy]);
                        return;
                }
 
                $users = DBA::count('user', ['blocked' => false, 'account_removed' => false, 'account_expired' => false]);
                if (($users >= $max_registered_users) && ($register_policy == Module\Register::OPEN)) {
                        DI::config()->set('config', 'register_policy', Module\Register::CLOSED);
-                       Logger::notice('Max users reached, registration is closed.', ['users' => $users, 'max' => $max_registered_users]);
+                       DI::logger()->notice('Max users reached, registration is closed.', ['users' => $users, 'max' => $max_registered_users]);
                } elseif (($users < $max_registered_users) && ($register_policy == Module\Register::CLOSED)) {
                        DI::config()->set('config', 'register_policy', Module\Register::OPEN);
-                       Logger::notice('Below maximum users, registration is opened.', ['users' => $users, 'max' => $max_registered_users]);
+                       DI::logger()->notice('Below maximum users, registration is opened.', ['users' => $users, 'max' => $max_registered_users]);
                } else {
-                       Logger::debug('Unchanged register policy', ['policy' => $register_policy, 'users' => $users, 'max' => $max_registered_users]);
+                       DI::logger()->debug('Unchanged register policy', ['policy' => $register_policy, 'users' => $users, 'max' => $max_registered_users]);
                }
        }
 }