// don't store post if we don't have a contact
- if(! x($datarray,'contact-id'))
+ if(! x($datarray,'contact-id')) {
+ logger('no contact: post ignored');
continue;
+ }
$datarray['verb'] = ACTIVITY_POST;
if($wall) {
intval($top_item),
intval($uid)
);
- if(count($r))
+ if(count($r)) {
$orig_post = $r[0];
+ logger('fb: new top level item posted');
+ }
}
if(isset($entry->likes) && isset($entry->likes->data))
$arr['uri'], // already dbesc'd
intval($arr['uid'])
);
+ if(! count($r)) {
+ // This is not good, but perhaps we encountered a rare race/cache condition, so back off and try again.
+ sleep(3);
+ $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ $arr['uri'], // already dbesc'd
+ intval($arr['uid'])
+ );
+ }
+
if(count($r)) {
$current_post = $r[0]['id'];
logger('item_store: created item ' . $current_post);