diff options
author | Mario Vavti <mario@mariovavti.com> | 2021-01-10 21:46:31 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2021-01-10 21:46:31 +0100 |
commit | 707110e5a786a1884f6b9afec683fe63795a1566 (patch) | |
tree | 2251882eb3ba0d2f2d0fa465baecd7a63c1b3d82 | |
parent | ba9a9cb016c80ffb60427510d864a0f553da535b (diff) | |
download | volse-hubzilla-707110e5a786a1884f6b9afec683fe63795a1566.tar.gz volse-hubzilla-707110e5a786a1884f6b9afec683fe63795a1566.tar.bz2 volse-hubzilla-707110e5a786a1884f6b9afec683fe63795a1566.zip |
sync_directories() omit known dead sites
-rw-r--r-- | Zotlabs/Lib/Libzotdir.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Zotlabs/Lib/Libzotdir.php b/Zotlabs/Lib/Libzotdir.php index b02516a98..31755476c 100644 --- a/Zotlabs/Lib/Libzotdir.php +++ b/Zotlabs/Lib/Libzotdir.php @@ -188,8 +188,9 @@ class Libzotdir { return; $realm = get_directory_realm(); + if ($realm == DIRECTORY_REALM) { - $r = q("select * from site where (site_flags & %d) > 0 and site_url != '%s' and site_type = %d and ( site_realm = '%s' or site_realm = '') ", + $r = q("select * from site where (site_flags & %d) > 0 and site_url != '%s' and site_type = %d and ( site_realm = '%s' or site_realm = '') and site_dead = 0", intval(DIRECTORY_MODE_PRIMARY|DIRECTORY_MODE_SECONDARY), dbesc(z_root()), intval(SITE_TYPE_ZOT), @@ -197,7 +198,7 @@ class Libzotdir { ); } else { - $r = q("select * from site where (site_flags & %d) > 0 and site_url != '%s' and site_realm like '%s' and site_type = %d ", + $r = q("select * from site where (site_flags & %d) > 0 and site_url != '%s' and site_realm like '%s' and site_type = %d and site_dead = 0", intval(DIRECTORY_MODE_PRIMARY|DIRECTORY_MODE_SECONDARY), dbesc(z_root()), dbesc(protect_sprintf('%' . $realm . '%')), @@ -205,6 +206,8 @@ class Libzotdir { ); } + + // If there are no directory servers, setup the fallback master /** @FIXME What to do if we're in a different realm? */ @@ -221,7 +224,7 @@ class Libzotdir { ] ); - $r = q("select * from site where site_flags in (%d, %d) and site_url != '%s' and site_type = %d ", + $r = q("select * from site where site_flags in (%d, %d) and site_url != '%s' and site_type = %d and site_dead = 0", intval(DIRECTORY_MODE_PRIMARY), intval(DIRECTORY_MODE_SECONDARY), dbesc(z_root()), @@ -245,7 +248,6 @@ class Libzotdir { $syncdate = (($rr['site_sync'] <= NULL_DATE) ? datetime_convert('UTC','UTC','now - 2 days') : $rr['site_sync']); $x = z_fetch_url($rr['site_directory'] . '?f=&sync=' . urlencode($syncdate) . (($token) ? '&t=' . $token : '')); - if (! $x['success']) continue; |