From 7f6139620d1742de32e7ca738044794506727745 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 18 Oct 2023 20:16:59 +0000 Subject: [PATCH 1/2] Langfilter: Use two letter code for the language / Bluesky: Remove callstack --- bluesky/bluesky.php | 5 ++--- langfilter/langfilter.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bluesky/bluesky.php b/bluesky/bluesky.php index 6e6ad609..2d497e8c 100644 --- a/bluesky/bluesky.php +++ b/bluesky/bluesky.php @@ -32,7 +32,6 @@ use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Core\Renderer; -use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; @@ -1235,7 +1234,7 @@ function bluesky_add_media(stdClass $embed, array $item, int $fetch_uid, int $le function bluesky_get_uri(stdClass $post): string { if (empty($post->cid)) { - Logger::info('Invalid URI', ['post' => $post, 'callstack' => System::callstack(10, 0, true)]); + Logger::info('Invalid URI', ['post' => $post]); return ''; } return $post->uri . ':' . $post->cid; @@ -1337,7 +1336,7 @@ function bluesky_fetch_post(string $uri, int $uid): string function bluesky_process_thread(stdClass $thread, int $uid, array $cdata, int $level): string { if (empty($thread->post)) { - Logger::info('Invalid post', ['post' => $thread, 'callstack' => System::callstack(10, 0, true)]); + Logger::info('Invalid post', ['post' => $thread]); return ''; } $uri = bluesky_get_uri($thread->post); diff --git a/langfilter/langfilter.php b/langfilter/langfilter.php index 9cb57a6c..e5efa8fb 100644 --- a/langfilter/langfilter.php +++ b/langfilter/langfilter.php @@ -163,7 +163,7 @@ function langfilter_prepare_body_content_filter(&$hook_data) return; } - $lang = $iso639->languageByCode1($iso2); + $lang = $iso639->languageByCode1(substr($iso2, 0, 2)); } else { $opts = $hook_data['item']['postopts']; if (!$opts) { -- 2.43.0 From d317eb71d121adbcc349357e6afee44ae949790b Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 29 Oct 2023 11:39:45 +0000 Subject: [PATCH 2/2] Bluesky: Fix warnings --- bluesky/bluesky.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluesky/bluesky.php b/bluesky/bluesky.php index 2d497e8c..d5ab6e42 100644 --- a/bluesky/bluesky.php +++ b/bluesky/bluesky.php @@ -1307,7 +1307,7 @@ function bluesky_fetch_missing_post(string $uri, int $uid, int $causer, int $lev return $fallback; } - Logger::debug('Reply count', ['replies' => $data->thread->post->replyCount, 'level' => $level, 'uid' => $uid, 'uri' => $uri]); + Logger::debug('Reply count', ['level' => $level, 'uid' => $uid, 'uri' => $uri]); if ($causer != 0) { $cdata = Contact::getPublicAndUserContactID($causer, $uid); -- 2.43.0