From 8a907a789f080ccae45e5b44d0bc43ed65477e07 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 13 Oct 2014 17:59:03 -0700 Subject: more diagnostic when changing primary --- include/hubloc.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'include/hubloc.php') 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; } -- cgit v1.2.3