From 9f1fa5aba27d7f169569734190cfb9279160207c Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 21 Jul 2013 17:19:16 -0700 Subject: improvements in delivery logging --- include/notifier.php | 33 +++++++++++++++++++++++++-------- include/zot.php | 16 ++++++++-------- version.inc | 2 +- 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/include/notifier.php b/include/notifier.php index 96c0bf31f..9a8866223 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -334,18 +334,26 @@ function notifier_run($argv, $argc){ if(! $recipients) return; - logger('notifier: recipients: ' . print_r($recipients,true)); +// logger('notifier: recipients: ' . print_r($recipients,true)); - $env_recips = null; - if($private) { - $r = q("select xchan_guid, xchan_guid_sig from xchan where xchan_hash in (" . implode(',',$recipients) . ")"); - if($r) { - $env_recips = array(); - foreach($r as $rr) - $env_recips[] = array('guid' => $rr['xchan_guid'],'guid_sig' => $rr['xchan_guid_sig']); + $env_recips = (($private) ? array() : null); + + $details = q("select xchan_hash, xchan_addr, xchan_guid, xchan_guid_sig from xchan where xchan_hash in (" . implode(',',$recipients) . ")"); + + $recip_list = array(); + + if($details) { + foreach($details as $d) { + $recip_list[] = $d['xchan_addr'] . ' (' . $d['xchan_hash'] . ')'; + if($private) + $env_recips[] = array('guid' => $d['xchan_guid'],'guid_sig' => $d['xchan_guid_sig']); } } + + logger('notifier: recipients (may be delivered to more if public): ' . print_r($recip_list,true), LOGGER_DEBUG); + + // Now we have collected recipients (except for external mentions, FIXME) // Let's reduce this to a set of hubs. @@ -362,6 +370,11 @@ function notifier_run($argv, $argc){ } $hubs = $r; + $hublist = array(); + foreach($hubs as $hub) + $hublist[] = $hub['hubloc_host']; + + logger('notifier: will notify/deliver to these hubs: ' . print_r($hublist,true), LOGGER_DEBUG); $interval = ((get_config('system','delivery_interval') !== false) ? intval(get_config('system','delivery_interval')) : 2 ); @@ -418,12 +431,16 @@ function notifier_run($argv, $argc){ if(count($deliver)) { proc_run('php','include/deliver.php',$deliver); } + + logger('notifier: basic loop complete.', LOGGER_DEBUG); if($normal_mode) call_hooks('notifier_normal',$target_item); + call_hooks('notifier_end',$target_item); + logger('notifer: complete.'); return; } diff --git a/include/zot.php b/include/zot.php index 6d68d9087..269982487 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1031,7 +1031,7 @@ function process_delivery($sender,$arr,$deliveries,$relay) { ); if(! $r) { - $result[] = array($d['hash'],'not found'); + $result[] = array($d['hash'],'recipients not found'); continue; } @@ -1043,7 +1043,7 @@ function process_delivery($sender,$arr,$deliveries,$relay) { if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery)) { logger("permission denied for delivery {$channel['channel_id']}"); - $result[] = array($d['hash'],'permission denied',$channel['channel_name']); + $result[] = array($d['hash'],'permission denied',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); continue; } @@ -1053,12 +1053,12 @@ function process_delivery($sender,$arr,$deliveries,$relay) { remove_community_tag($sender,$arr,$channel['channel_id']); $item_id = delete_imported_item($sender,$arr,$channel['channel_id']); - $result[] = array($d['hash'],'deleted'); + $result[] = array($d['hash'],'deleted',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); if($relay && $item_id) { logger('process_delivery: invoking relay'); proc_run('php','include/notifier.php','relay',intval($item_id)); - $result[] = array($d['hash'],'relayed',$channel['channel_name']); + $result[] = array($d['hash'],'relayed',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); } continue; @@ -1089,7 +1089,7 @@ function process_delivery($sender,$arr,$deliveries,$relay) { $xyz = event_store($ev); - $result = array($d['hash'],'event processed',$channel['channel_name']); + $result = array($d['hash'],'event processed',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); continue; } } @@ -1106,20 +1106,20 @@ function process_delivery($sender,$arr,$deliveries,$relay) { $arr['uid'] = $channel['channel_id']; update_imported_item($sender,$arr,$channel['channel_id']); } - $result[] = array($d['hash'],'updated',$channel['channel_name']); + $result[] = array($d['hash'],'updated',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); $item_id = $r[0]['id']; } else { $arr['aid'] = $channel['channel_account_id']; $arr['uid'] = $channel['channel_id']; $item_id = item_store($arr); - $result[] = array($d['hash'],(($item_id) ? 'posted' : 'storage failed'),$channel['channel_name']); + $result[] = array($d['hash'],(($item_id) ? 'posted' : 'storage failed'),$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); } if($relay && $item_id) { logger('process_delivery: invoking relay'); proc_run('php','include/notifier.php','relay',intval($item_id)); - $result[] = array($d['hash'],'relayed',$channel['channel_name']); + $result[] = array($d['hash'],'relayed',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); } } diff --git a/version.inc b/version.inc index 2ec45cf19..b91b9734b 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2013-07-20.380 +2013-07-21.381 -- cgit v1.2.3