From 4791b2fd9c6dabc9ebb1f42a4993185d85493261 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 20 Nov 2013 21:09:13 -0800 Subject: add aid to notifiy table which we may need to supress duplicate notify emails across your channels also try to handle the wretched mess of broken and duplicated hublocs that fred.cepheus.uberspace.de typically reports --- include/notifier.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'include/notifier.php') diff --git a/include/notifier.php b/include/notifier.php index 1407be4b3..2ca3531d6 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -408,9 +408,9 @@ function notifier_run($argv, $argc){ // for public posts always include our own hub - $sql_extra = (($private) ? "" : " or hubloc_url = '" . z_root() . "' "); + $sql_extra = (($private) ? "" : " or hubloc_url = '" . dbesc(z_root()) . "' "); - $r = q("select distinct hubloc_sitekey, hubloc_flags, hubloc_callback, hubloc_host from hubloc + $r = q("select hubloc_sitekey, hubloc_flags, hubloc_callback, hubloc_host from hubloc where hubloc_hash in (" . implode(',',$recipients) . ") $sql_extra group by hubloc_sitekey"); if(! $r) { logger('notifier: no hubs'); @@ -419,10 +419,14 @@ function notifier_run($argv, $argc){ $hubs = $r; $hublist = array(); + $keys = array(); + foreach($hubs as $hub) { - // don't try to deliver to deleted hublocs - if(! ($hub['hubloc_flags'] & HUBLOC_FLAGS_DELETED)) { + // don't try to deliver to deleted hublocs - and inexplicably SQL "distinct" and "group by" + // both return records with duplicate keys in rare circumstances + if((! ($hub['hubloc_flags'] & HUBLOC_FLAGS_DELETED)) && (! in_array($hub['hubloc_sitekey'],$keys))) { $hublist[] = $hub['hubloc_host']; + $keys[] = $hub['hubloc_sitekey']; } } -- cgit v1.2.3