facebook: Bug fixed that prevent old posts from being fetched.

pull/40/head
Michael Vogel 2012-04-07 21:38:45 +02:00
parent d5e1359716
commit 94186ab475
1 changed files with 6 additions and 4 deletions

View File

@ -1208,9 +1208,9 @@ function fb_get_timeline($access_token, &$since) {
else else
break; break;
$url = $s->paging->next; $url = $j->paging->next;
} while (($oldestdate > $since) and ($since != 0)); } while (($oldestdate > $since) and ($since != 0) and ($url != ''));
if ($newest > $since) if ($newest > $since)
$since = $newest; $since = $newest;
@ -1241,13 +1241,11 @@ function fb_consume_all($uid) {
} }
// Get the last date // Get the last date
$lastdate = get_pconfig($uid,'facebook','lastdate'); $lastdate = get_pconfig($uid,'facebook','lastdate');
// echo "Alt: ".$lastdate."\n";
// fetch all items since the last date // fetch all items since the last date
$j = fb_get_timeline($access_token, &$lastdate); $j = fb_get_timeline($access_token, &$lastdate);
if (isset($j->data)) { if (isset($j->data)) {
logger('fb_consume_stream: feed: ' . print_r($j,true), LOGGER_DATA); logger('fb_consume_stream: feed: ' . print_r($j,true), LOGGER_DATA);
fb_consume_stream($uid,$j,false); fb_consume_stream($uid,$j,false);
// echo "Neu: ".$lastdate."\n";
// Write back the last date // Write back the last date
set_pconfig($uid,'facebook','lastdate', $lastdate); set_pconfig($uid,'facebook','lastdate', $lastdate);
@ -1432,6 +1430,10 @@ function fb_consume_stream($uid,$j,$wall = false) {
} }
} }
// Just as a test - to see if these are the missing entries
if(trim($datarray['body']) == '')
$datarray['body'] = $entry->story;
if(trim($datarray['body']) == '') { if(trim($datarray['body']) == '') {
logger('facebook: empty body '.$entry->id.' '.print_r($entry, true)); logger('facebook: empty body '.$entry->id.' '.print_r($entry, true));
continue; continue;