aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-09-18 14:31:29 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-09-18 14:31:29 -0700
commitfdd4c1b9d19c2002ee105633e6b54245e5066534 (patch)
treeb76773dcc53f25dd29a7e1695713dd03cc73c94d /include
parentf2fefb91d5f823385105fe693d0d82d7e236b511 (diff)
downloadvolse-hubzilla-fdd4c1b9d19c2002ee105633e6b54245e5066534.tar.gz
volse-hubzilla-fdd4c1b9d19c2002ee105633e6b54245e5066534.tar.bz2
volse-hubzilla-fdd4c1b9d19c2002ee105633e6b54245e5066534.zip
more work on surviving hub re-installs
Diffstat (limited to 'include')
-rw-r--r--include/zot.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/zot.php b/include/zot.php
index ebdcb4cfb..69e361331 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -296,13 +296,17 @@ function zot_refresh($them, $channel = null, $force = false) {
} else {
$r = null;
+ // if they re-installed the server we could end up with the wrong record - pointing to the old install.
+ // We'll order by reverse id to try and pick off the newest one first and hopefully end up with the
+ // correct hubloc. If this doesn't work we may have to re-write this section to try them all.
+
if(array_key_exists('xchan_addr',$them) && $them['xchan_addr']) {
- $r = q("select hubloc_url, hubloc_primary from hubloc where hubloc_addr = '%s'",
+ $r = q("select hubloc_url, hubloc_primary from hubloc where hubloc_addr = '%s' order by hubloc_id desc",
dbesc($them['xchan_addr'])
);
}
if(! $r) {
- $r = q("select hubloc_url, hubloc_primary from hubloc where hubloc_hash = '%s'",
+ $r = q("select hubloc_url, hubloc_primary from hubloc where hubloc_hash = '%s' order by hubloc_id desc",
dbesc($them['xchan_hash'])
);
}