From 17df97fccdc680dd3ec2aa7eb808c09460ae1d07 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 22 Jan 2023 13:45:33 +0000 Subject: [PATCH 1/2] Twitter: Move config to key value --- twitter/twitter.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/twitter/twitter.php b/twitter/twitter.php index d7cce96ae..f35ff8d3e 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -829,7 +829,7 @@ function twitter_post_hook(array &$b) Logger::info('twitter_post send', ['id' => $b['id'], 'result' => $result]); if (!empty($result->source)) { - DI::config()->set('twitter', 'application_name', strip_tags($result->source)); + DI::keyValue()->set('twitter_application_name', strip_tags($result->source)); } if (!empty($result->errors)) { @@ -875,7 +875,7 @@ function twitter_post_hook(array &$b) } if (!empty($application_name)) { - DI::config()->set('twitter', 'application_name', strip_tags($application_name)); + DI::keyValue()->set('twitter_application_name', strip_tags($application_name)); } } } @@ -1288,7 +1288,7 @@ function twitter_fetchtimeline(int $uid): void $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); $lastid = DI::pConfig()->get($uid, 'twitter', 'lastid'); - $application_name = DI::config()->get('twitter', 'application_name'); + $application_name = DI::keyValue()->get('twitter_application_name'); if ($application_name == '') { $application_name = DI::baseUrl()->getHostname(); @@ -2187,7 +2187,7 @@ function twitter_fetchhometimeline(int $uid): void Logger::info('Fetching timeline', ['uid' => $uid]); - $application_name = DI::config()->get('twitter', 'application_name'); + $application_name = DI::keyValue()->get('twitter_application_name'); if ($application_name == '') { $application_name = DI::baseUrl()->getHostname(); From 85275d447347617d745586dde1882967aa7d39b6 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 22 Jan 2023 21:39:12 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Hypolite Petovan --- twitter/twitter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/twitter/twitter.php b/twitter/twitter.php index f35ff8d3e..5aeecf30d 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -1288,7 +1288,7 @@ function twitter_fetchtimeline(int $uid): void $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); $lastid = DI::pConfig()->get($uid, 'twitter', 'lastid'); - $application_name = DI::keyValue()->get('twitter_application_name'); + $application_name = DI::keyValue()->get('twitter_application_name') ?? ''; if ($application_name == '') { $application_name = DI::baseUrl()->getHostname(); @@ -2187,7 +2187,7 @@ function twitter_fetchhometimeline(int $uid): void Logger::info('Fetching timeline', ['uid' => $uid]); - $application_name = DI::keyValue()->get('twitter_application_name'); + $application_name = DI::keyValue()->get('twitter_application_name') ?? ''; if ($application_name == '') { $application_name = DI::baseUrl()->getHostname();