From fe8bb8fec6eb80f57a2b3c9f3ed33159350fbad3 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Tue, 29 Oct 2013 08:09:44 +0100 Subject: [PATCH] Some more debug information for twitter-sync and facebook-sync --- fbsync/fbsync.php | 5 +++++ twitter/twitter.php | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/fbsync/fbsync.php b/fbsync/fbsync.php index 76e82e70..6e5ef2c9 100644 --- a/fbsync/fbsync.php +++ b/fbsync/fbsync.php @@ -681,6 +681,11 @@ function fbsync_fetchfeed($a, $uid) { $data = json_decode($feed); + if (!is_array($data->data)) { + logger("fbsync_fetchfeed: Error fetching data for user ".$uid.": ".print_r($data, true)); + return; + } + $posts = array(); $comments = array(); $likes = array(); diff --git a/twitter/twitter.php b/twitter/twitter.php index b7bf77f0..e18b7445 100755 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -1516,21 +1516,27 @@ function twitter_fetchhometimeline($a, $uid) { if(count($r)) { $own_id = $r[0]["nick"]; - } else + } else { + logger("twitter_fetchhometimeline: Own twitter contact not found for user ".$uid, LOGGER_DEBUG); return; + } $r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1", intval($uid)); if(count($r)) { $self = $r[0]; - } else + } else { + logger("twitter_fetchhometimeline: Own contact not found for user ".$uid, LOGGER_DEBUG); return; + } $u = q("SELECT * FROM user WHERE uid = %d LIMIT 1", intval($uid)); - if(!count($u)) + if(!count($u)) { + logger("twitter_fetchhometimeline: Own user not found for user ".$uid, LOGGER_DEBUG); return; + } $parameters = array("exclude_replies" => false, "trim_user" => false, "contributor_details" => true, "include_rts" => true); //$parameters["count"] = 200; @@ -1546,8 +1552,10 @@ function twitter_fetchhometimeline($a, $uid) { $items = $connection->get('statuses/home_timeline', $parameters); - if (!is_array($items)) + if (!is_array($items)) { + logger("twitter_fetchhometimeline: Error fetching home timeline: ".print_r($items, true), LOGGER_DEBUG); return; + } $posts = array_reverse($items); @@ -1587,8 +1595,10 @@ function twitter_fetchhometimeline($a, $uid) { $items = $connection->get('statuses/mentions_timeline', $parameters); - if (!is_array($items)) + if (!is_array($items)) { + logger("twitter_fetchhometimeline: Error fetching mentions: ".print_r($items, true), LOGGER_DEBUG); return; + } $posts = array_reverse($items); -- 2.39.5