forked from friendica/friendica-addons
fbpost: Setting the extid only when it is no toplevel post. (important for fbsync)
This commit is contained in:
parent
a2f42c681b
commit
72176cd94b
|
@ -756,9 +756,10 @@ function fbpost_post_hook(&$a,&$b) {
|
||||||
|
|
||||||
$retj = json_decode($x);
|
$retj = json_decode($x);
|
||||||
if($retj->id) {
|
if($retj->id) {
|
||||||
if (!$toplevel)
|
// Only set the extid when it isn't the toplevel post
|
||||||
q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d LIMIT 1",
|
q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d AND `parent` != %d",
|
||||||
dbesc('fb::' . $retj->id),
|
dbesc('fb::' . $retj->id),
|
||||||
|
intval($b['id']),
|
||||||
intval($b['id'])
|
intval($b['id'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -767,6 +768,7 @@ function fbpost_post_hook(&$a,&$b) {
|
||||||
$s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $postvars));
|
$s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $postvars));
|
||||||
require_once('include/queue_fn.php');
|
require_once('include/queue_fn.php');
|
||||||
add_to_queue($a->contact,NETWORK_FACEBOOK,$s);
|
add_to_queue($a->contact,NETWORK_FACEBOOK,$s);
|
||||||
|
logger('fbpost_post_hook: Post failed, requeued.', LOGGER_DEBUG);
|
||||||
notice( t('Facebook post failed. Queued for retry.') . EOL);
|
notice( t('Facebook post failed. Queued for retry.') . EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -884,7 +886,7 @@ function fbpost_queue_hook(&$a,&$b) {
|
||||||
$fb_token = get_pconfig($user['uid'],'facebook','access_token');
|
$fb_token = get_pconfig($user['uid'],'facebook','access_token');
|
||||||
|
|
||||||
if($fb_post && $fb_token) {
|
if($fb_post && $fb_token) {
|
||||||
logger('facebook_queue: able to post');
|
logger('fbpost_queue_hook: able to post');
|
||||||
require_once('library/facebook.php');
|
require_once('library/facebook.php');
|
||||||
|
|
||||||
$z = unserialize($x['content']);
|
$z = unserialize($x['content']);
|
||||||
|
@ -894,15 +896,16 @@ function fbpost_queue_hook(&$a,&$b) {
|
||||||
$retj = json_decode($j);
|
$retj = json_decode($j);
|
||||||
if($retj->id) {
|
if($retj->id) {
|
||||||
// Only set the extid when it isn't the toplevel post
|
// Only set the extid when it isn't the toplevel post
|
||||||
q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d AND `parent` != $d LIMIT 1",
|
q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d AND `parent` != %d",
|
||||||
dbesc('fb::' . $retj->id),
|
dbesc('fb::' . $retj->id),
|
||||||
|
intval($item),
|
||||||
intval($item)
|
intval($item)
|
||||||
);
|
);
|
||||||
logger('facebook_queue: success: ' . $j);
|
logger('fbpost_queue_hook: success: ' . $j);
|
||||||
remove_queue_item($x['id']);
|
remove_queue_item($x['id']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logger('facebook_queue: failed: ' . $j);
|
logger('fbpost_queue_hook: failed: ' . $j);
|
||||||
update_queue_time($x['id']);
|
update_queue_time($x['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue