]> git.mxchange.org Git - friendica.git/commitdiff
Replace Logger with DI::logger() in Model Post classes
authorArt4 <art4@wlabs.de>
Mon, 13 Jan 2025 09:51:46 +0000 (09:51 +0000)
committerArt4 <art4@wlabs.de>
Mon, 13 Jan 2025 09:51:46 +0000 (09:51 +0000)
src/Model/Post.php
src/Model/Post/Delayed.php
src/Model/Post/Engagement.php
src/Model/Post/History.php
src/Model/Post/Link.php
src/Model/Post/Media.php
src/Model/Post/SearchIndex.php
src/Model/Post/UserNotification.php

index 3118e2e84c057093b7e1c81daf3a25d2a3e2091c..765ad023acb5d4366d21cf5901c390c1301868f1 100644 (file)
@@ -8,7 +8,6 @@
 namespace Friendica\Model;
 
 use BadMethodCallException;
-use Friendica\Core\Logger;
 use Friendica\Database\Database;
 use Friendica\Database\DBA;
 use Friendica\DI;
@@ -621,7 +620,7 @@ class Post
        {
                $affected = 0;
 
-               Logger::info('Start Update', ['fields' => $fields, 'condition' => $condition, 'uid' => DI::userSession()->getLocalUserId()]);
+               DI::logger()->info('Start Update', ['fields' => $fields, 'condition' => $condition, 'uid' => DI::userSession()->getLocalUserId()]);
 
                // Don't allow changes to fields that are responsible for the relation between the records
                unset($fields['id']);
@@ -647,7 +646,7 @@ class Post
                                $puids = array_column($rows, 'post-user-id');
                                if (!DBA::update('post-user', $update_fields, ['id' => $puids])) {
                                        DBA::rollback();
-                                       Logger::warning('Updating post-user failed', ['fields' => $update_fields, 'condition' => $condition]);
+                                       DI::logger()->warning('Updating post-user failed', ['fields' => $update_fields, 'condition' => $condition]);
                                        return false;
                                }
                                $affected_count += DBA::affectedRows();
@@ -664,7 +663,7 @@ class Post
                                $uriids = array_column($rows, 'uri-id');
                                if (!DBA::update('post-content', $update_fields, ['uri-id' => $uriids])) {
                                        DBA::rollback();
-                                       Logger::warning('Updating post-content failed', ['fields' => $update_fields, 'condition' => $condition]);
+                                       DI::logger()->warning('Updating post-content failed', ['fields' => $update_fields, 'condition' => $condition]);
                                        return false;
                                }
                                $affected_count += DBA::affectedRows();
@@ -687,7 +686,7 @@ class Post
 
                                if (!DBA::update('post', $update_fields, ['uri-id' => $uriids])) {
                                        DBA::rollback();
-                                       Logger::warning('Updating post failed', ['fields' => $update_fields, 'condition' => $condition]);
+                                       DI::logger()->warning('Updating post failed', ['fields' => $update_fields, 'condition' => $condition]);
                                        return false;
                                }
                                $affected_count += DBA::affectedRows();
@@ -704,7 +703,7 @@ class Post
                                $uriids = array_column($rows, 'uri-id');
                                if (!DBA::update('post-delivery-data', $update_fields, ['uri-id' => $uriids])) {
                                        DBA::rollback();
-                                       Logger::warning('Updating post-delivery-data failed', ['fields' => $update_fields, 'condition' => $condition]);
+                                       DI::logger()->warning('Updating post-delivery-data failed', ['fields' => $update_fields, 'condition' => $condition]);
                                        return false;
                                }
                                $affected_count += DBA::affectedRows();
@@ -721,7 +720,7 @@ class Post
                                $uriids = array_column($rows, 'uri-id');
                                if (!DBA::update('post-thread', $update_fields, ['uri-id' => $uriids])) {
                                        DBA::rollback();
-                                       Logger::warning('Updating post-thread failed', ['fields' => $update_fields, 'condition' => $condition]);
+                                       DI::logger()->warning('Updating post-thread failed', ['fields' => $update_fields, 'condition' => $condition]);
                                        return false;
                                }
                                $affected_count += DBA::affectedRows();
@@ -738,7 +737,7 @@ class Post
                                $thread_puids = array_column($rows, 'post-user-id');
                                if (!DBA::update('post-thread-user', $update_fields, ['post-user-id' => $thread_puids])) {
                                        DBA::rollback();
-                                       Logger::warning('Updating post-thread-user failed', ['fields' => $update_fields, 'condition' => $condition]);
+                                       DI::logger()->warning('Updating post-thread-user failed', ['fields' => $update_fields, 'condition' => $condition]);
                                        return false;
                                }
                                $affected_count += DBA::affectedRows();
@@ -749,7 +748,7 @@ class Post
 
                DBA::commit();
 
-               Logger::info('Updated posts', ['rows' => $affected]);
+               DI::logger()->info('Updated posts', ['rows' => $affected]);
                return $affected;
        }
 
index 666e55c3d4a41c089bb907e6d3e81336c1d1ed1f..2e30ba1a59f4f8f0c8d6611459e299cef7ced007 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Model\Post;
 
-use Friendica\Core\Logger;
 use Friendica\Database\DBA;
 use Friendica\Core\Worker;
 use Friendica\Database\Database;
@@ -45,7 +44,7 @@ class Delayed
        public static function add(string $uri, array $item, int $notify = 0, int $preparation_mode = self::PREPARED, string $delayed = '', array $taglist = [], array $attachments = [])
        {
                if (empty($item['uid']) || self::exists($uri, $item['uid'])) {
-                       Logger::notice('No uid or already found');
+                       DI::logger()->notice('No uid or already found');
                        return 0;
                }
 
@@ -58,7 +57,7 @@ class Delayed
                        DI::pConfig()->set($item['uid'], 'system', 'last_publish', $next_publish);
                }
 
-               Logger::notice('Adding post for delayed publishing', ['uid' => $item['uid'], 'delayed' => $delayed, 'uri' => $uri]);
+               DI::logger()->notice('Adding post for delayed publishing', ['uid' => $item['uid'], 'delayed' => $delayed, 'uri' => $uri]);
 
                $wid = Worker::add(['priority' => Worker::PRIORITY_HIGH, 'delayed' => $delayed], 'DelayedPublish', $item, $notify, $taglist, $attachments, $preparation_mode, $uri);
                if (!$wid) {
@@ -181,7 +180,7 @@ class Delayed
 
                $id = Item::insert($item, $notify, $preparation_mode == self::PREPARED);
 
-               Logger::notice('Post stored', ['id' => $id, 'uid' => $item['uid'], 'cid' => $item['contact-id'] ?? 'N/A']);
+               DI::logger()->notice('Post stored', ['id' => $id, 'uid' => $item['uid'], 'cid' => $item['contact-id'] ?? 'N/A']);
 
                if (empty($uri) && !empty($item['uri'])) {
                        $uri = $item['uri'];
index b48818437c22ac53825c38a5e7ed8ef6c34a90c0..621d3ee9ecd614a521d10e44d3987f110673665a 100644 (file)
@@ -9,7 +9,6 @@ namespace Friendica\Model\Post;
 
 use Friendica\Content\Text\BBCode;
 use Friendica\Core\L10n;
-use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Database\DBA;
 use Friendica\DI;
@@ -48,7 +47,7 @@ class Engagement
        public static function storeFromItem(array $item): int
        {
                if (in_array($item['verb'], [Activity::FOLLOW, Activity::VIEW, Activity::READ])) {
-                       Logger::debug('Technical activities are not stored', ['uri-id' => $item['uri-id'], 'parent-uri-id' => $item['parent-uri-id'], 'verb' => $item['verb']]);
+                       DI::logger()->debug('Technical activities are not stored', ['uri-id' => $item['uri-id'], 'parent-uri-id' => $item['parent-uri-id'], 'verb' => $item['verb']]);
                        return 0;
                }
 
@@ -59,7 +58,7 @@ class Engagement
                        ['uri-id' => $item['parent-uri-id']]);
 
                if ($parent['created'] < self::getCreationDateLimit(false)) {
-                       Logger::debug('Post is too old', ['uri-id' => $item['uri-id'], 'parent-uri-id' => $item['parent-uri-id'], 'created' => $parent['created']]);
+                       DI::logger()->debug('Post is too old', ['uri-id' => $item['uri-id'], 'parent-uri-id' => $item['parent-uri-id'], 'created' => $parent['created']]);
                        return 0;
                }
 
@@ -114,16 +113,16 @@ class Engagement
                        ])
                ];
                if (!$store && ($engagement['comments'] == 0) && ($engagement['activities'] == 0)) {
-                       Logger::debug('No media, follower, subscribed tags, comments or activities. Engagement not stored', ['fields' => $engagement]);
+                       DI::logger()->debug('No media, follower, subscribed tags, comments or activities. Engagement not stored', ['fields' => $engagement]);
                        return 0;
                }
                $exists = DBA::exists('post-engagement', ['uri-id' => $engagement['uri-id']]);
                if ($exists) {
                        $ret = DBA::update('post-engagement', $engagement, ['uri-id' => $engagement['uri-id']]);
-                       Logger::debug('Engagement updated', ['uri-id' => $engagement['uri-id'], 'ret' => $ret]);
+                       DI::logger()->debug('Engagement updated', ['uri-id' => $engagement['uri-id'], 'ret' => $ret]);
                } else {
                        $ret = DBA::insert('post-engagement', $engagement);
-                       Logger::debug('Engagement inserted', ['uri-id' => $engagement['uri-id'], 'ret' => $ret]);
+                       DI::logger()->debug('Engagement inserted', ['uri-id' => $engagement['uri-id'], 'ret' => $ret]);
                }
                return ($ret && !$exists) ? $engagement['uri-id'] : 0;
        }
@@ -369,11 +368,11 @@ class Engagement
        {
                $limit = self::getCreationDateLimit(true);
                if (empty($limit)) {
-                       Logger::notice('Expiration limit not reached');
+                       DI::logger()->notice('Expiration limit not reached');
                        return;
                }
                DBA::delete('post-engagement', ["`created` < ?", $limit]);
-               Logger::notice('Cleared expired engagements', ['limit' => $limit, 'rows' => DBA::affectedRows()]);
+               DI::logger()->notice('Cleared expired engagements', ['limit' => $limit, 'rows' => DBA::affectedRows()]);
        }
 
        private static function getCreationDateLimit(bool $forDeletion): string
index 03b6da19d0f0c809f9d44b6df3b78e5f51be710b..192a82996c011346b1b7efc0dcc80822f2c7ce8f 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Model\Post;
 
-use Friendica\Core\Logger;
 use Friendica\Database\DBA;
 use Friendica\Database\Database;
 use Friendica\DI;
@@ -28,12 +27,12 @@ class History
 
                $post = Post::selectFirstPost($fields, ['uri-id' => $uri_id]);
                if (empty($post)) {
-                       Logger::warning('Post not found', ['uri-id' => $uri_id]);
+                       DI::logger()->warning('Post not found', ['uri-id' => $uri_id]);
                        return;
                }
 
                if ($item['edited'] <= $post['edited']) {
-                       Logger::info('New edit date is not newer than the old one', ['uri-id' => $uri_id, 'old' => $post['edited'], 'new' => $item['edited']]);
+                       DI::logger()->info('New edit date is not newer than the old one', ['uri-id' => $uri_id, 'old' => $post['edited'], 'new' => $item['edited']]);
                        return;
                }
 
@@ -49,9 +48,9 @@ class History
 
                if ($update) {
                        DBA::insert('post-history', $post, Database::INSERT_IGNORE);
-                       Logger::info('Added history', ['uri-id' => $uri_id, 'edited' => $post['edited']]);
+                       DI::logger()->info('Added history', ['uri-id' => $uri_id, 'edited' => $post['edited']]);
                } else {
-                       Logger::info('No content fields had been changed', ['uri-id' => $uri_id, 'edited' => $post['edited']]);
+                       DI::logger()->info('No content fields had been changed', ['uri-id' => $uri_id, 'edited' => $post['edited']]);
                }
        }
 }
index 64901c2c28ae86100dd0af3a56b38b4f570a6eeb..2315928186d008df58d585009725328518d42a9a 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Model\Post;
 
-use Friendica\Core\Logger;
 use Friendica\Database\Database;
 use Friendica\Database\DBA;
 use Friendica\DI;
@@ -53,14 +52,14 @@ class Link
                }
 
                if (!in_array(parse_url($url, PHP_URL_SCHEME), ['http', 'https'])) {
-                       Logger::info('Bad URL, quitting', ['uri-id' => $uriId, 'url' => $url]);
+                       DI::logger()->info('Bad URL, quitting', ['uri-id' => $uriId, 'url' => $url]);
                        return $url;
                }
 
                $link = DBA::selectFirst('post-link', ['id'], ['uri-id' => $uriId, 'url' => $url]);
                if (!empty($link['id'])) {
                        $id = $link['id'];
-                       Logger::info('Found', ['id' => $id, 'uri-id' => $uriId, 'url' => $url]);
+                       DI::logger()->info('Found', ['id' => $id, 'uri-id' => $uriId, 'url' => $url]);
                } else {
                        $fields = self::fetchMimeType($url);
                        $fields['uri-id'] = $uriId;
@@ -68,7 +67,7 @@ class Link
 
                        DBA::insert('post-link', $fields, Database::INSERT_IGNORE);
                        $id = DBA::lastInsertId();
-                       Logger::info('Inserted', $fields);
+                       DI::logger()->info('Inserted', $fields);
                }
 
                if (empty($id)) {
@@ -114,12 +113,12 @@ class Link
                try {
                        $curlResult = HTTPSignature::fetchRaw($url, 0, [HttpClientOptions::TIMEOUT => $timeout, HttpClientOptions::ACCEPT_CONTENT => $accept]);
                } catch (\Exception $exception) {
-                       Logger::notice('Error fetching url', ['url' => $url, 'exception' => $exception]);
+                       DI::logger()->notice('Error fetching url', ['url' => $url, 'exception' => $exception]);
                        return [];
                }
 
                if (!$curlResult->isSuccess()) {
-                       Logger::notice('Fetching unsuccessful', ['url' => $url]);
+                       DI::logger()->notice('Fetching unsuccessful', ['url' => $url]);
                        return [];
                }
 
index f05b5e001660bbe5e9049de445df41e05fda0e6d..7384f71ca5887a0f713e149b2144954b78e456ef 100644 (file)
@@ -9,7 +9,6 @@ namespace Friendica\Model\Post;
 
 use Friendica\Content\PageInfo;
 use Friendica\Content\Text\BBCode;
-use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Database\Database;
 use Friendica\Database\DBA;
@@ -67,12 +66,12 @@ class Media
        public static function insert(array $media, bool $force = false): bool
        {
                if (empty($media['url']) || empty($media['uri-id']) || !isset($media['type'])) {
-                       Logger::warning('Incomplete media data', ['media' => $media]);
+                       DI::logger()->warning('Incomplete media data', ['media' => $media]);
                        return false;
                }
 
                if (DBA::exists('post-media', ['uri-id' => $media['uri-id'], 'preview' => $media['url']])) {
-                       Logger::info('Media already exists as preview', ['uri-id' => $media['uri-id'], 'url' => $media['url']]);
+                       DI::logger()->info('Media already exists as preview', ['uri-id' => $media['uri-id'], 'url' => $media['url']]);
                        return false;
                }
 
@@ -80,12 +79,12 @@ class Media
                // and embedded as picture then we only store the picture or replace the document
                $found = DBA::selectFirst('post-media', ['type'], ['uri-id' => $media['uri-id'], 'url' => $media['url']]);
                if (!$force && !empty($found) && (!in_array($found['type'], [self::UNKNOWN, self::DOCUMENT]) || ($media['type'] == self::DOCUMENT))) {
-                       Logger::info('Media already exists', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'found' => $found['type'], 'new' => $media['type']]);
+                       DI::logger()->info('Media already exists', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'found' => $found['type'], 'new' => $media['type']]);
                        return false;
                }
 
                if (!ItemURI::exists($media['uri-id'])) {
-                       Logger::info('Media referenced URI ID not found', ['uri-id' => $media['uri-id'], 'url' => $media['url']]);
+                       DI::logger()->info('Media referenced URI ID not found', ['uri-id' => $media['uri-id'], 'url' => $media['url']]);
                        return false;
                }
 
@@ -97,7 +96,7 @@ class Media
                // We are storing as fast as possible to avoid duplicated network requests
                // when fetching additional information for pictures and other content.
                $result = DBA::insert('post-media', $media, Database::INSERT_UPDATE);
-               Logger::info('Stored media', ['result' => $result, 'media' => $media]);
+               DI::logger()->info('Stored media', ['result' => $result, 'media' => $media]);
                $stored = $media;
 
                $media = self::fetchAdditionalData($media);
@@ -106,9 +105,9 @@ class Media
 
                if (array_diff_assoc($media, $stored)) {
                        $result = DBA::insert('post-media', $media, Database::INSERT_UPDATE);
-                       Logger::info('Updated media', ['result' => $result, 'media' => $media]);
+                       DI::logger()->info('Updated media', ['result' => $result, 'media' => $media]);
                } else {
-                       Logger::info('Nothing to update', ['media' => $media]);
+                       DI::logger()->info('Nothing to update', ['media' => $media]);
                }
                return $result;
        }
@@ -183,7 +182,7 @@ class Media
                                return $media;
                        }
                        if (empty($media['mimetype']) || empty($media['size'])) {
-                               Logger::debug('Unknown local link', ['url' => $media['url']]);
+                               DI::logger()->debug('Unknown local link', ['url' => $media['url']]);
                        }
                }
 
@@ -205,10 +204,10 @@ class Media
                                                $media['size'] = (int)($curlResult->getHeader('Content-Length')[0] ?? strlen($curlResult->getBodyString() ?? ''));
                                        }
                                } else {
-                                       Logger::notice('Could not fetch head', ['media' => $media, 'code' => $curlResult->getReturnCode()]);
+                                       DI::logger()->notice('Could not fetch head', ['media' => $media, 'code' => $curlResult->getReturnCode()]);
                                }
                        } catch (\Throwable $th) {
-                               Logger::notice('Got exception', ['code' => $th->getCode(), 'message' => $th->getMessage()]);
+                               DI::logger()->notice('Got exception', ['code' => $th->getCode(), 'message' => $th->getMessage()]);
                        }
                }
 
@@ -216,7 +215,7 @@ class Media
                        $media = self::addType($media);
                }
 
-               Logger::debug('Got type for url', ['type' => $media['type'], 'mimetype' => $media['mimetype'] ?? '', 'url' => $media['url']]);
+               DI::logger()->debug('Got type for url', ['type' => $media['type'], 'mimetype' => $media['mimetype'] ?? '', 'url' => $media['url']]);
 
                if ($media['type'] == self::IMAGE) {
                        $imagedata = Images::getInfoFromURLCached($media['url'], empty($media['description']));
@@ -228,10 +227,10 @@ class Media
                                $media['blurhash'] = $imagedata['blurhash'] ?? null;
                                if (!empty($imagedata['description']) && empty($media['description'])) {
                                        $media['description'] = $imagedata['description'];
-                                       Logger::debug('Detected text for image', $media);
+                                       DI::logger()->debug('Detected text for image', $media);
                                }
                        } else {
-                               Logger::notice('No image data', ['media' => $media]);
+                               DI::logger()->notice('No image data', ['media' => $media]);
                        }
                }
 
@@ -309,13 +308,13 @@ class Media
 
                $item = Post::selectFirst([], ['id' => $id, 'network' => Protocol::FEDERATED]);
                if (empty($item['id'])) {
-                       Logger::debug('Not a federated activity', ['id' => $id, 'uri-id' => $media['uri-id'], 'url' => $media['url']]);
+                       DI::logger()->debug('Not a federated activity', ['id' => $id, 'uri-id' => $media['uri-id'], 'url' => $media['url']]);
                        $media['type'] = $media['type'] == self::ACTIVITY ? self::JSON : $media['type'];
                        return $media;
                }
 
                if ($item['uri-id'] == $media['uri-id']) {
-                       Logger::info('Media-Uri-Id is identical to Uri-Id', ['uri-id' => $media['uri-id']]);
+                       DI::logger()->info('Media-Uri-Id is identical to Uri-Id', ['uri-id' => $media['uri-id']]);
                        $media['type'] = $media['type'] == self::ACTIVITY ? self::JSON : $media['type'];
                        return $media;
                }
@@ -324,7 +323,7 @@ class Media
                        !empty($item['plink']) && Strings::compareLink($item['plink'], $media['url']) &&
                        parse_url($item['plink'], PHP_URL_HOST) != parse_url($item['uri'], PHP_URL_HOST)
                ) {
-                       Logger::debug('Not a link to an activity', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'plink' => $item['plink'], 'uri' => $item['uri']]);
+                       DI::logger()->debug('Not a link to an activity', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'plink' => $item['plink'], 'uri' => $item['uri']]);
                        $media['type'] = $media['type'] == self::ACTIVITY ? self::JSON : $media['type'];
                        return $media;
                }
@@ -357,7 +356,7 @@ class Media
                $media['publisher-name']  = $gserver['site_name'] ?? null;
                $media['publisher-image'] = null;
 
-               Logger::debug('Activity detected', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'plink' => $item['plink'], 'uri' => $item['uri']]);
+               DI::logger()->debug('Activity detected', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'plink' => $item['plink'], 'uri' => $item['uri']]);
                return $media;
        }
 
@@ -399,7 +398,7 @@ class Media
                $media['publisher-name']  = $gserver['site_name'] ?? null;
                $media['publisher-image'] = null;
 
-               Logger::debug('Account detected', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'uri' => $contact['url']]);
+               DI::logger()->debug('Account detected', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'uri' => $contact['url']]);
                return $media;
        }
 
@@ -415,7 +414,7 @@ class Media
                if (empty($data['images'][0]['src']) && empty($data['text']) && empty($data['title'])) {
                        if (!empty($media['preview'])) {
                                $media = self::addPreviewData($media);
-                               Logger::debug('Detected site data is empty, use suggested media data instead', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'type' => $data['type']]);
+                               DI::logger()->debug('Detected site data is empty, use suggested media data instead', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'type' => $data['type']]);
                        }
                } else {
                        $media['preview']        = $data['images'][0]['src']      ?? null;
@@ -489,7 +488,7 @@ class Media
        public static function addType(array $data): array
        {
                if (empty($data['mimetype'])) {
-                       Logger::info('No MimeType provided', ['media' => $data]);
+                       DI::logger()->info('No MimeType provided', ['media' => $data]);
                        return $data;
                }
 
@@ -501,7 +500,7 @@ class Media
        {
                $type = explode('/', current(explode(';', $mimeType)));
                if (count($type) < 2) {
-                       Logger::info('Unknown MimeType', ['type' => $type, 'media' => $mimeType]);
+                       DI::logger()->info('Unknown MimeType', ['type' => $type, 'media' => $mimeType]);
                        return self::UNKNOWN;
                }
 
@@ -536,10 +535,10 @@ class Media
                        $type = self::APPLICATION;
                } else {
                        $type = self::UNKNOWN;
-                       Logger::info('Unknown type', ['filetype' => $filetype, 'subtype' => $subtype, 'media' => $mimeType]);
+                       DI::logger()->info('Unknown type', ['filetype' => $filetype, 'subtype' => $subtype, 'media' => $mimeType]);
                }
 
-               Logger::debug('Detected type', ['type' => $type, 'filetype' => $filetype, 'subtype' => $subtype, 'media' => $mimeType]);
+               DI::logger()->debug('Detected type', ['type' => $type, 'filetype' => $filetype, 'subtype' => $subtype, 'media' => $mimeType]);
                return $type;
        }
 
@@ -777,15 +776,15 @@ class Media
                // Search for pure links
                if (preg_match_all("/\[url\](https?:.*?)\[\/url\]/ism", $body, $matches)) {
                        foreach ($matches[1] as $url) {
-                               Logger::info('Got page url (link without description)', ['uri-id' => $uriid, 'url' => $url]);
+                               DI::logger()->info('Got page url (link without description)', ['uri-id' => $uriid, 'url' => $url]);
                                $result = self::insert(['uri-id' => $uriid, 'type' => self::UNKNOWN, 'url' => $url], false);
                                if ($result && !in_array($network, [Protocol::ACTIVITYPUB, Protocol::DIASPORA])) {
                                        self::revertHTMLType($uriid, $url, $fullbody);
-                                       Logger::debug('Revert HTML type', ['uri-id' => $uriid, 'url' => $url]);
+                                       DI::logger()->debug('Revert HTML type', ['uri-id' => $uriid, 'url' => $url]);
                                } elseif ($result) {
-                                       Logger::debug('Media had been added', ['uri-id' => $uriid, 'url' => $url]);
+                                       DI::logger()->debug('Media had been added', ['uri-id' => $uriid, 'url' => $url]);
                                } else {
-                                       Logger::debug('Media had not been added', ['uri-id' => $uriid, 'url' => $url]);
+                                       DI::logger()->debug('Media had not been added', ['uri-id' => $uriid, 'url' => $url]);
                                }
                        }
                }
@@ -793,15 +792,15 @@ class Media
                // Search for links with descriptions
                if (preg_match_all("/\[url\=(https?:.*?)\].*?\[\/url\]/ism", $body, $matches)) {
                        foreach ($matches[1] as $url) {
-                               Logger::info('Got page url (link with description)', ['uri-id' => $uriid, 'url' => $url]);
+                               DI::logger()->info('Got page url (link with description)', ['uri-id' => $uriid, 'url' => $url]);
                                $result = self::insert(['uri-id' => $uriid, 'type' => self::UNKNOWN, 'url' => $url], false);
                                if ($result && !in_array($network, [Protocol::ACTIVITYPUB, Protocol::DIASPORA])) {
                                        self::revertHTMLType($uriid, $url, $fullbody);
-                                       Logger::debug('Revert HTML type', ['uri-id' => $uriid, 'url' => $url]);
+                                       DI::logger()->debug('Revert HTML type', ['uri-id' => $uriid, 'url' => $url]);
                                } elseif ($result) {
-                                       Logger::debug('Media has been added', ['uri-id' => $uriid, 'url' => $url]);
+                                       DI::logger()->debug('Media has been added', ['uri-id' => $uriid, 'url' => $url]);
                                } else {
-                                       Logger::debug('Media has not been added', ['uri-id' => $uriid, 'url' => $url]);
+                                       DI::logger()->debug('Media has not been added', ['uri-id' => $uriid, 'url' => $url]);
                                }
                        }
                }
@@ -838,7 +837,7 @@ class Media
                        return;
                }
 
-               Logger::info('Adding attachment data', ['data' => $data]);
+               DI::logger()->info('Adding attachment data', ['data' => $data]);
                $attachment = [
                        'uri-id'         => $uriid,
                        'type'           => self::HTML,
index 61410871e24eac3082741b255d1b8e8f1c338815..1c57f77942b0b83a4cc481b19e1fd6d0b55c03b7 100644 (file)
@@ -8,7 +8,6 @@
 namespace Friendica\Model\Post;
 
 use Friendica\Core\L10n;
-use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Database\Database;
 use Friendica\Database\DBA;
@@ -74,7 +73,7 @@ class SearchIndex
                        return;
                }
                DBA::delete('post-searchindex', ["`created` < ?", $limit]);
-               Logger::notice('Cleared expired searchindex entries', ['limit' => $limit, 'rows' => DBA::affectedRows()]);
+               DI::logger()->notice('Cleared expired searchindex entries', ['limit' => $limit, 'rows' => DBA::affectedRows()]);
        }
 
        public static function searchAgeDateLimit(): string
index 35c3d7891c06e68fcff521aa5058874fbccc145b..e72d3ac353f6475470613df4108b78818a2309ea 100644 (file)
@@ -10,7 +10,6 @@ namespace Friendica\Model\Post;
 use BadMethodCallException;
 use Exception;
 use Friendica\Core\Hook;
-use Friendica\Core\Logger;
 use Friendica\Database\Database;
 use Friendica\Database\DBA;
 use Friendica\DI;
@@ -174,14 +173,14 @@ class UserNotification
                                continue;
                        }
                        if (Contact\User::isBlocked($author_id, $uid) || Contact\User::isIgnored($author_id, $uid) || Contact\User::isCollapsed($author_id, $uid)) {
-                               Logger::debug('Author is blocked/ignored/collapsed by user', ['uid' => $uid, 'author' => $author_id, 'uri-id' => $item['uri-id']]);
+                               DI::logger()->debug('Author is blocked/ignored/collapsed by user', ['uid' => $uid, 'author' => $author_id, 'uri-id' => $item['uri-id']]);
                                return;
                        }
                }
 
                foreach (array_unique([$parent['author-gsid'], $parent['owner-gsid'], $parent['causer-gsid'], $item['author-gsid'], $item['owner-gsid'], $item['causer-gsid']]) as $gsid) {
                        if ($gsid && DI::userGServer()->isIgnoredByUser($uid, $gsid)) {
-                               Logger::debug('Server is ignored by user', ['uid' => $uid, 'gsid' => $gsid, 'uri-id' => $item['uri-id']]);
+                               DI::logger()->debug('Server is ignored by user', ['uid' => $uid, 'gsid' => $gsid, 'uri-id' => $item['uri-id']]);
                                return;
                        }
                }
@@ -313,7 +312,7 @@ class UserNotification
                        return;
                }
 
-               Logger::info('Set notification', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'notification-type' => $notification_type]);
+               DI::logger()->info('Set notification', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'notification-type' => $notification_type]);
 
                $fields = ['notification-type' => $notification_type];
                Post\User::update($item['uri-id'], $uid, $fields);