aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-03-03 15:22:24 -0800
committerfriendica <info@friendica.com>2015-03-03 15:22:24 -0800
commit85f79990af13a2c71aa9c053761de6dbf8f37841 (patch)
treeee7e85980e77f00e569b5f94967fcfc1441af076
parent52f42e7d8131f4b68fb6277e1ae286e7e76ad75d (diff)
downloadvolse-hubzilla-85f79990af13a2c71aa9c053761de6dbf8f37841.tar.gz
volse-hubzilla-85f79990af13a2c71aa9c053761de6dbf8f37841.tar.bz2
volse-hubzilla-85f79990af13a2c71aa9c053761de6dbf8f37841.zip
don't let a zot-finger bring a dead hub back to life unless it's the site we're currently talking to.
-rw-r--r--include/zot.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/zot.php b/include/zot.php
index e1c780742..29513b8c5 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -2036,7 +2036,7 @@ function sync_locations($sender,$arr,$absolute = false) {
$ret = array();
if($arr['locations']) {
-
+
$xisting = q("select hubloc_id, hubloc_url, hubloc_sitekey from hubloc where hubloc_hash = '%s'",
dbesc($sender['hash'])
);
@@ -2100,19 +2100,21 @@ function sync_locations($sender,$arr,$absolute = false) {
// update connection timestamp if this is the site we're talking to
// This only happens when called from import_xchan
+ $current_site = false;
+
if(array_key_exists('site',$arr) && $location['url'] == $arr['site']['url']) {
q("update hubloc set hubloc_connected = '%s', hubloc_updated = '%s' where hubloc_id = %d",
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($r[0]['hubloc_id'])
);
+ $current_site = true;
}
- // if it's marked offline/dead, bring it back
- // Should we do this? It's basically saying that the channel knows better than
- // the directory server if the site is alive.
+ // If it is the site we're currently talking to, and it's marked offline,
+ // either we have some bad information - or the thing came back to life.
- if($r[0]['hubloc_status'] & HUBLOC_OFFLINE) {
+ if(($current_site) && ($r[0]['hubloc_status'] & HUBLOC_OFFLINE)) {
q("update hubloc set hubloc_status = (hubloc_status & ~%d) where hubloc_id = %d",
intval(HUBLOC_OFFLINE),
intval($r[0]['hubloc_id'])