allow parentless items from SN - add more tracing on notify failures
This commit is contained in:
parent
e2c8bedfe5
commit
c6b00f7230
2 changed files with 28 additions and 8 deletions
|
@ -611,7 +611,7 @@ function encode_rel_links($links) {
|
||||||
return xmlify($o);
|
return xmlify($o);
|
||||||
}
|
}
|
||||||
|
|
||||||
function item_store($arr) {
|
function item_store($arr,$force_parent = false) {
|
||||||
|
|
||||||
if($arr['gravity'])
|
if($arr['gravity'])
|
||||||
$arr['gravity'] = intval($arr['gravity']);
|
$arr['gravity'] = intval($arr['gravity']);
|
||||||
|
@ -694,11 +694,23 @@ function item_store($arr) {
|
||||||
$deny_cid = $r[0]['deny_cid'];
|
$deny_cid = $r[0]['deny_cid'];
|
||||||
$deny_gid = $r[0]['deny_gid'];
|
$deny_gid = $r[0]['deny_gid'];
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
// Allow one to see reply tweets from status.net even when
|
||||||
|
// we don't have or can't see the original post.
|
||||||
|
|
||||||
|
if($force_parent) {
|
||||||
|
logger('item_store: $force_parent=true, reply converted to top-level post.');
|
||||||
|
$parent_id = 0;
|
||||||
|
$arr['thr-parent'] = $arr['parent-uri'];
|
||||||
|
$arr['parent-uri'] = $arr['uri'];
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
logger('item_store: item parent was not found - ignoring item');
|
logger('item_store: item parent was not found - ignoring item');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
call_hooks('post_remote',$arr);
|
call_hooks('post_remote',$arr);
|
||||||
|
|
||||||
|
@ -1194,8 +1206,9 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$datarray = get_atom_elements($feed,$item);
|
$datarray = get_atom_elements($feed,$item);
|
||||||
|
$force_parent = false;
|
||||||
if($contact['network'] === 'stat') {
|
if($contact['network'] === 'stat') {
|
||||||
|
$force_parent = true;
|
||||||
if(strlen($datarray['title']))
|
if(strlen($datarray['title']))
|
||||||
unset($datarray['title']);
|
unset($datarray['title']);
|
||||||
$r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
|
$r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
|
||||||
|
@ -1218,7 +1231,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0) {
|
||||||
$datarray['gravity'] = GRAVITY_LIKE;
|
$datarray['gravity'] = GRAVITY_LIKE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = item_store($datarray);
|
$r = item_store($datarray,$force_parent);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,13 @@ function dfrn_notify_post(&$a) {
|
||||||
dbesc($challenge)
|
dbesc($challenge)
|
||||||
);
|
);
|
||||||
if(! count($r)) {
|
if(! count($r)) {
|
||||||
logger('dfrn_notify: could not match challenge to dfrn_id ' . $dfrn_id);
|
logger('dfrn_notify: could not match challenge to dfrn_id ' . $dfrn_id . ' challenge=' . $challenge);
|
||||||
|
|
||||||
|
// apply some extra tracing
|
||||||
|
dbg(1);
|
||||||
|
q("SELECT * FROM `challenge` WHERE 1");
|
||||||
|
dbg(0);
|
||||||
|
|
||||||
xml_status(3);
|
xml_status(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,12 +474,13 @@ function dfrn_notify_content(&$a) {
|
||||||
$r = q("DELETE FROM `challenge` WHERE `expire` < " . intval(time()));
|
$r = q("DELETE FROM `challenge` WHERE `expire` < " . intval(time()));
|
||||||
|
|
||||||
$r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` )
|
$r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` )
|
||||||
VALUES( '%s', '%s', '%s') ",
|
VALUES( '%s', '%s', %d ) ",
|
||||||
dbesc($hash),
|
dbesc($hash),
|
||||||
dbesc($dfrn_id),
|
dbesc($dfrn_id),
|
||||||
intval(time() + 60 )
|
intval(time() + 90 )
|
||||||
);
|
);
|
||||||
|
|
||||||
|
logger('dfrn_notify: challenge=' . $hash . ' return value=' . $r);
|
||||||
|
|
||||||
$sql_extra = '';
|
$sql_extra = '';
|
||||||
switch($direction) {
|
switch($direction) {
|
||||||
|
|
Loading…
Reference in a new issue