aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-12-17 11:57:16 -0800
committerfriendica <info@friendica.com>2014-12-17 11:57:16 -0800
commitb9dc23844c6363a876479a6f867f4d3eb9190928 (patch)
treef75c99ce75b6e8923fb56c040b74bd9e95983add /include
parent4e1dbc13d47c432ef6bb52137ec85d84c5da964d (diff)
downloadvolse-hubzilla-b9dc23844c6363a876479a6f867f4d3eb9190928.tar.gz
volse-hubzilla-b9dc23844c6363a876479a6f867f4d3eb9190928.tar.bz2
volse-hubzilla-b9dc23844c6363a876479a6f867f4d3eb9190928.zip
make unique hub filter more robust and straight-forward so it's easier to understand and debug since it's such a critical piece of the delivery chain
Diffstat (limited to 'include')
-rw-r--r--include/notifier.php32
1 files changed, 25 insertions, 7 deletions
diff --git a/include/notifier.php b/include/notifier.php
index 931732686..e1eb0c554 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -510,16 +510,34 @@ function notifier_run($argv, $argc){
$hubs = $r;
- $hublist = array();
- $dhubs = array();
- $keys = array();
+
+ /**
+ * Reduce the hubs to those that are unique. For zot hubs, we need to verify uniqueness by the sitekey, since it may have been
+ * a re-install which has not yet been detected and pruned.
+ * For other networks which don't have or require sitekeys, we'll have to use the URL
+ */
+
+
+ $hublist = array(); // this provides an easily printable list for the logs
+ $dhubs = array(); // delivery hubs where we store our resulting unique array
+ $keys = array(); // array of keys to check uniquness for zot hubs
+ $urls = array(); // array of urls to check uniqueness of hubs from other networks
+
foreach($hubs as $hub) {
- if((! $hub['hubloc_sitekey']) || (! in_array($hub['hubloc_sitekey'],$keys))) {
- $hublist[] = $hub['hubloc_host'];
- $dhubs[] = $hub;
- if($hub['hubloc_sitekey'])
+ if($hub['hubloc_network'] == 'zot') {
+ if(! in_array($hub['hubloc_sitekey'],$keys)) {
+ $hublist[] = $hub['hubloc_host'];
+ $dhubs[] = $hub;
$keys[] = $hub['hubloc_sitekey'];
+ }
+ }
+ else {
+ if(! in_array($hub['hubloc_url'],$urls)) {
+ $hublist[] = $hub['hubloc_host'];
+ $dhubs[] = $hub;
+ $urls[] = $hub['hubloc_url'];
+ }
}
}