more diagnostic when changing primary
This commit is contained in:
parent
3d56bb5cd7
commit
8a907a789f
@ -115,10 +115,16 @@ function remove_obsolete_hublocs() {
|
|||||||
|
|
||||||
function hubloc_change_primary($hubloc) {
|
function hubloc_change_primary($hubloc) {
|
||||||
|
|
||||||
if(! is_array($hubloc))
|
if(! is_array($hubloc)) {
|
||||||
|
logger('no hubloc');
|
||||||
return false;
|
return false;
|
||||||
if(! $hubloc['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY)
|
}
|
||||||
|
if(! ($hubloc['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY)) {
|
||||||
|
logger('not primary: ' . $hubloc['hubloc_url']);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
logger('setting primary: ' . $hubloc['hubloc_url']);
|
||||||
|
|
||||||
// See if there's a local channel
|
// 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",
|
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
|
||||||
dbesc($hubloc['hubloc_hash'])
|
dbesc($hubloc['hubloc_hash'])
|
||||||
);
|
);
|
||||||
if(! $r)
|
if(! $r) {
|
||||||
|
logger('xchan not found');
|
||||||
return false;
|
return false;
|
||||||
if($r[0]['xchan_addr'] === $hubloc['hubloc_addr'])
|
}
|
||||||
|
if($r[0]['xchan_addr'] === $hubloc['hubloc_addr']) {
|
||||||
|
logger('xchan already changed');
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$url = $hubloc['hubloc_url'];
|
$url = $hubloc['hubloc_url'];
|
||||||
$lwebbie = substr($hubloc['hubloc_addr'],0,strpos($hubloc['hubloc_addr'],'@'));
|
$lwebbie = substr($hubloc['hubloc_addr'],0,strpos($hubloc['hubloc_addr'],'@'));
|
||||||
@ -151,7 +161,10 @@ function hubloc_change_primary($hubloc) {
|
|||||||
dbesc($url . '/poco/' . $lwebbie),
|
dbesc($url . '/poco/' . $lwebbie),
|
||||||
dbesc($hubloc['hubloc_hash'])
|
dbesc($hubloc['hubloc_hash'])
|
||||||
);
|
);
|
||||||
|
if(! $r)
|
||||||
|
logger('xchan_update failed.');
|
||||||
|
|
||||||
|
logger('primary hubloc changed.' . print_r($hubloc,true),LOGGER_DEBUG);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user