Bugfix: The duplicate check for likes wasn't reliable

This commit is contained in:
Michael Vogel 2016-01-03 00:17:28 +01:00
parent 0f615fdcd7
commit 6c3d0f82c2
3 changed files with 12 additions and 12 deletions

View file

@ -276,7 +276,7 @@ function delivery_run(&$argv, &$argc){
switch($contact['network']) { switch($contact['network']) {
case NETWORK_DFRN: case NETWORK_DFRN:
logger('notifier: dfrndelivery: ' . $contact['name']); logger('notifier: '.$target_item["guid"].' dfrndelivery: ' . $contact['name']);
$feed_template = get_markup_template('atom_feed.tpl'); $feed_template = get_markup_template('atom_feed.tpl');
$mail_template = get_markup_template('atom_mail.tpl'); $mail_template = get_markup_template('atom_mail.tpl');
@ -402,15 +402,15 @@ function delivery_run(&$argv, &$argc){
if($normal_mode) { if($normal_mode) {
if($item_id == $item['id'] || $item['id'] == $item['parent']) if($item_id == $item['id'] || $item['id'] == $item['parent'])
$atom .= atom_entry($item,'text',null,$owner,true,(($top_level) ? $contact['id'] : 0)); $atom .= atom_entry($item,'text',null,$owner,true,(($top_level) ? $contact['id'] : 0));
} } else
else
$atom .= atom_entry($item,'text',null,$owner,true); $atom .= atom_entry($item,'text',null,$owner,true);
} }
} }
$atom .= '</feed>' . "\r\n"; $atom .= '</feed>' . "\r\n";
logger('notifier: '.$contact["url"].' '.$target_item["guid"].' entry: '.$atom, LOGGER_DEBUG);
logger('notifier: ' . $atom, LOGGER_DATA); logger('notifier: ' . $atom, LOGGER_DATA);
$basepath = implode('/', array_slice(explode('/',$contact['url']),0,3)); $basepath = implode('/', array_slice(explode('/',$contact['url']),0,3));
@ -470,7 +470,7 @@ function delivery_run(&$argv, &$argc){
else else
$deliver_status = (-1); $deliver_status = (-1);
logger('notifier: dfrn_delivery returns ' . $deliver_status); logger('notifier: dfrn_delivery to '.$contact["url"].' with guid '.$target_item["guid"].' returns '.$deliver_status);
if($deliver_status == (-1)) { if($deliver_status == (-1)) {
logger('notifier: delivery failed: queuing message'); logger('notifier: delivery failed: queuing message');

View file

@ -3717,7 +3717,7 @@ function local_delivery($importer,$data) {
$datarray['owner-avatar'] = $own[0]['thumb']; $datarray['owner-avatar'] = $own[0]['thumb'];
$datarray['contact-id'] = $importer['id']; $datarray['contact-id'] = $importer['id'];
if(($datarray['verb'] === ACTIVITY_LIKE) if(($datarray['verb'] === ACTIVITY_LIKE)
|| ($datarray['verb'] === ACTIVITY_DISLIKE) || ($datarray['verb'] === ACTIVITY_DISLIKE)
|| ($datarray['verb'] === ACTIVITY_ATTEND) || ($datarray['verb'] === ACTIVITY_ATTEND)
|| ($datarray['verb'] === ACTIVITY_ATTENDNO) || ($datarray['verb'] === ACTIVITY_ATTENDNO)
@ -3728,9 +3728,9 @@ function local_delivery($importer,$data) {
$datarray['last-child'] = 0; $datarray['last-child'] = 0;
// only one like or dislike per person // only one like or dislike per person
// splitted into two queries for performance issues // splitted into two queries for performance issues
$r = q("select id from item where uid = %d and `contact-id` = %d and verb = '%s' and (`parent-uri` = '%s') and deleted = 0 limit 1", $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `author-link` = '%s' AND `verb` = '%s' AND `parent-uri` = '%s' AND NOT `deleted` LIMIT 1",
intval($datarray['uid']), intval($datarray['uid']),
intval($datarray['contact-id']), dbesc($datarray['author-link']),
dbesc($datarray['verb']), dbesc($datarray['verb']),
dbesc($datarray['parent-uri']) dbesc($datarray['parent-uri'])
@ -3738,9 +3738,9 @@ function local_delivery($importer,$data) {
if($r && count($r)) if($r && count($r))
continue; continue;
$r = q("select id from item where uid = %d and `contact-id` = %d and verb = '%s' and (`thr-parent` = '%s') and deleted = 0 limit 1", $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `author-link` = '%s' AND `verb` = '%s' AND `thr-parent` = '%s' AND NOT `deleted` LIMIT 1",
intval($datarray['uid']), intval($datarray['uid']),
intval($datarray['contact-id']), dbesc($datarray['author-link']),
dbesc($datarray['verb']), dbesc($datarray['verb']),
dbesc($datarray['parent-uri']) dbesc($datarray['parent-uri'])

View file

@ -559,7 +559,7 @@ function notifier_run(&$argv, &$argc){
$r = array_merge($r2,$r1,$r0); $r = array_merge($r2,$r1,$r0);
if(count($r)) { if(count($r)) {
logger('pubdeliver: ' . print_r($r,true), LOGGER_DEBUG); logger('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG);
// throw everything into the queue in case we get killed // throw everything into the queue in case we get killed
@ -584,7 +584,7 @@ function notifier_run(&$argv, &$argc){
} }
if((! $mail) && (! $fsuggest) && (! $followup)) { if((! $mail) && (! $fsuggest) && (! $followup)) {
logger('notifier: delivery agent: ' . $rr['name'] . ' ' . $rr['id']); logger('notifier: delivery agent: '.$rr['name'].' '.$rr['id'].' '.$rr['network'].' '.$target_item["guid"]);
proc_run('php','include/delivery.php',$cmd,$item_id,$rr['id']); proc_run('php','include/delivery.php',$cmd,$item_id,$rr['id']);
if($interval) if($interval)
@time_sleep_until(microtime(true) + (float) $interval); @time_sleep_until(microtime(true) + (float) $interval);