aboutsummaryrefslogtreecommitdiffstats
path: root/include/notifier.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-11-20 21:09:13 -0800
committerfriendica <info@friendica.com>2013-11-20 21:09:13 -0800
commit4791b2fd9c6dabc9ebb1f42a4993185d85493261 (patch)
tree4a63752ec22345dabc3e8d07c483046c91547a98 /include/notifier.php
parenteb3d8e2cd7e2bd51035918b4106d1c29b6605505 (diff)
downloadvolse-hubzilla-4791b2fd9c6dabc9ebb1f42a4993185d85493261.tar.gz
volse-hubzilla-4791b2fd9c6dabc9ebb1f42a4993185d85493261.tar.bz2
volse-hubzilla-4791b2fd9c6dabc9ebb1f42a4993185d85493261.zip
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
Diffstat (limited to 'include/notifier.php')
-rw-r--r--include/notifier.php12
1 files changed, 8 insertions, 4 deletions
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'];
}
}