diff options
Diffstat (limited to 'include/hubloc.php')
-rw-r--r-- | include/hubloc.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/include/hubloc.php b/include/hubloc.php index 1906833c5..735aad432 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -115,10 +115,16 @@ function remove_obsolete_hublocs() { function hubloc_change_primary($hubloc) { - if(! is_array($hubloc)) + if(! is_array($hubloc)) { + logger('no hubloc'); return false; - if(! $hubloc['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) + } + if(! ($hubloc['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY)) { + logger('not primary: ' . $hubloc['hubloc_url']); return false; + } + + logger('setting primary: ' . $hubloc['hubloc_url']); // See if there's a local channel @@ -136,10 +142,14 @@ function hubloc_change_primary($hubloc) { $r = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($hubloc['hubloc_hash']) ); - if(! $r) + if(! $r) { + logger('xchan not found'); return false; - if($r[0]['xchan_addr'] === $hubloc['hubloc_addr']) + } + if($r[0]['xchan_addr'] === $hubloc['hubloc_addr']) { + logger('xchan already changed'); return false; + } $url = $hubloc['hubloc_url']; $lwebbie = substr($hubloc['hubloc_addr'],0,strpos($hubloc['hubloc_addr'],'@')); @@ -151,7 +161,10 @@ function hubloc_change_primary($hubloc) { dbesc($url . '/poco/' . $lwebbie), dbesc($hubloc['hubloc_hash']) ); + if(! $r) + logger('xchan_update failed.'); + logger('primary hubloc changed.' . print_r($hubloc,true),LOGGER_DEBUG); return true; } |