$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();
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;
$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);
$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);