]> git.mxchange.org Git - friendica.git/commitdiff
Bugfix: The duplicate check for likes wasn't reliable
authorMichael Vogel <icarus@dabo.de>
Sat, 2 Jan 2016 23:17:28 +0000 (00:17 +0100)
committerMichael Vogel <icarus@dabo.de>
Sat, 2 Jan 2016 23:17:28 +0000 (00:17 +0100)
include/delivery.php
include/items.php
include/notifier.php

index 7722b73953fdd376eb72434444bfc77e7f43e154..a8887336194d0083d2d9cdee547d61dacfab2017 100644 (file)
@@ -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 .= '</feed>' . "\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');
index e8905ae256ed27d86a954d5b879409037154ac7d..ff72ac57a4cedc11a1ee9d90dd7803a165888802 100644 (file)
@@ -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'])
 
index 99a736db0a81484625a11e65ff319c0c60682f53..92e48c355404a0f4bc1fb97451ea097d47f3f8b8 100644 (file)
@@ -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);