From 6c3d0f82c21f4dcd2d27650fd68bb9549e029cf2 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 3 Jan 2016 00:17:28 +0100 Subject: [PATCH] Bugfix: The duplicate check for likes wasn't reliable --- include/delivery.php | 10 +++++----- include/items.php | 10 +++++----- include/notifier.php | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/delivery.php b/include/delivery.php index 7722b7395..a88873361 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -276,7 +276,7 @@ function delivery_run(&$argv, &$argc){ switch($contact['network']) { case NETWORK_DFRN: - logger('notifier: dfrndelivery: ' . $contact['name']); + logger('notifier: '.$target_item["guid"].' dfrndelivery: ' . $contact['name']); $feed_template = get_markup_template('atom_feed.tpl'); $mail_template = get_markup_template('atom_mail.tpl'); @@ -402,15 +402,15 @@ function delivery_run(&$argv, &$argc){ if($normal_mode) { if($item_id == $item['id'] || $item['id'] == $item['parent']) $atom .= atom_entry($item,'text',null,$owner,true,(($top_level) ? $contact['id'] : 0)); - } - else + } else $atom .= atom_entry($item,'text',null,$owner,true); - } } $atom .= '' . "\r\n"; + logger('notifier: '.$contact["url"].' '.$target_item["guid"].' entry: '.$atom, LOGGER_DEBUG); + logger('notifier: ' . $atom, LOGGER_DATA); $basepath = implode('/', array_slice(explode('/',$contact['url']),0,3)); @@ -470,7 +470,7 @@ function delivery_run(&$argv, &$argc){ else $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)) { logger('notifier: delivery failed: queuing message'); diff --git a/include/items.php b/include/items.php index e8905ae25..ff72ac57a 100644 --- a/include/items.php +++ b/include/items.php @@ -3717,7 +3717,7 @@ function local_delivery($importer,$data) { $datarray['owner-avatar'] = $own[0]['thumb']; $datarray['contact-id'] = $importer['id']; - if(($datarray['verb'] === ACTIVITY_LIKE) + if(($datarray['verb'] === ACTIVITY_LIKE) || ($datarray['verb'] === ACTIVITY_DISLIKE) || ($datarray['verb'] === ACTIVITY_ATTEND) || ($datarray['verb'] === ACTIVITY_ATTENDNO) @@ -3728,9 +3728,9 @@ function local_delivery($importer,$data) { $datarray['last-child'] = 0; // only one like or dislike per person // 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['contact-id']), + dbesc($datarray['author-link']), dbesc($datarray['verb']), dbesc($datarray['parent-uri']) @@ -3738,9 +3738,9 @@ function local_delivery($importer,$data) { if($r && count($r)) 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['contact-id']), + dbesc($datarray['author-link']), dbesc($datarray['verb']), dbesc($datarray['parent-uri']) diff --git a/include/notifier.php b/include/notifier.php index 99a736db0..92e48c355 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -559,7 +559,7 @@ function notifier_run(&$argv, &$argc){ $r = array_merge($r2,$r1,$r0); 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 @@ -584,7 +584,7 @@ function notifier_run(&$argv, &$argc){ } 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']); if($interval) @time_sleep_until(microtime(true) + (float) $interval);