]> git.mxchange.org Git - friendica-addons.git/commitdiff
[twitter] Add logging for error conditions in twitter_fetchtimeline()
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 3 Jul 2022 15:40:59 +0000 (11:40 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 3 Jul 2022 15:40:59 +0000 (11:40 -0400)
twitter/twitter.php

index 5e3a4b9c2c17308dc62c55fe6bef172766a62089..dd3f898690e62cd558489e2cc1b168ec0d8ba815 100644 (file)
@@ -1257,22 +1257,26 @@ function twitter_fetchtimeline(App $a, int $uid)
                        }
 
                        if ($first_time) {
+                               Logger::warning('First time, continue');
                                continue;
                        }
 
-                       if (!stristr($post->source, $application_name)) {
-                               Logger::info('Preparing mirror post', ['twitter-id' => $post->id_str, 'uid' => $uid]);
+                       if (stristr($post->source, $application_name)) {
+                               Logger::warning('Source is application name', ['source' => $post->source, 'application_name' => $application_name]);
+                               continue;
+                       }
+                       Logger::info('Preparing mirror post', ['twitter-id' => $post->id_str, 'uid' => $uid]);
 
-                               $mirrorpost = twitter_do_mirrorpost($a, $uid, $post);
+                       $mirrorpost = twitter_do_mirrorpost($a, $uid, $post);
 
-                               if (empty($mirrorpost['body'])) {
-                                       continue;
-                               }
+                       if (empty($mirrorpost['body'])) {
+                               Logger::warning('Body is empty', ['post' => $post, 'mirrorpost' => $mirrorpost]);
+                               continue;
+                       }
 
-                               Logger::info('Posting mirror post', ['twitter-id' => $post->id_str, 'uid' => $uid]);
+                       Logger::info('Posting mirror post', ['twitter-id' => $post->id_str, 'uid' => $uid]);
 
-                               Post\Delayed::add($mirrorpost['extid'], $mirrorpost, PRIORITY_MEDIUM, Post\Delayed::UNPREPARED);
-                       }
+                       Post\Delayed::add($mirrorpost['extid'], $mirrorpost, PRIORITY_MEDIUM, Post\Delayed::UNPREPARED);
                }
        }
        DI::pConfig()->set($uid, 'twitter', 'lastid', $lastid);