aboutsummaryrefslogtreecommitdiffstats
path: root/include/hubloc.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-10-13 17:59:03 -0700
committerfriendica <info@friendica.com>2014-10-13 17:59:03 -0700
commit8a907a789f080ccae45e5b44d0bc43ed65477e07 (patch)
treeafce3f1b2ed848018713d7383e22c44310964770 /include/hubloc.php
parent3d56bb5cd72e2ca6d07fa4b79c4049b7c339af86 (diff)
downloadvolse-hubzilla-8a907a789f080ccae45e5b44d0bc43ed65477e07.tar.gz
volse-hubzilla-8a907a789f080ccae45e5b44d0bc43ed65477e07.tar.bz2
volse-hubzilla-8a907a789f080ccae45e5b44d0bc43ed65477e07.zip
more diagnostic when changing primary
Diffstat (limited to 'include/hubloc.php')
-rw-r--r--include/hubloc.php21
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;
}