figuring out how to bootstrap the change_primary procedure when all you have is inconsistent data which you think you trust.
This commit is contained in:
parent
79684e05cc
commit
0057612a9f
@ -113,6 +113,8 @@ function remove_obsolete_hublocs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// This actually changes other structures to match the given (presumably current) hubloc primary selection
|
||||||
|
|
||||||
function hubloc_change_primary($hubloc) {
|
function hubloc_change_primary($hubloc) {
|
||||||
|
|
||||||
if(! is_array($hubloc)) {
|
if(! is_array($hubloc)) {
|
||||||
|
@ -1849,6 +1849,10 @@ function sync_locations($sender,$arr,$absolute = false) {
|
|||||||
$what .= 'primary_hub ';
|
$what .= 'primary_hub ';
|
||||||
$changed = true;
|
$changed = true;
|
||||||
}
|
}
|
||||||
|
elseif($absolute) {
|
||||||
|
// Absolute sync - make sure the current primary is correctly reflected in the xchan
|
||||||
|
hubloc_change_primary($r[0]);
|
||||||
|
}
|
||||||
if((($r[0]['hubloc_flags'] & HUBLOC_FLAGS_DELETED) && (! $location['deleted']))
|
if((($r[0]['hubloc_flags'] & HUBLOC_FLAGS_DELETED) && (! $location['deleted']))
|
||||||
|| ((! ($r[0]['hubloc_flags'] & HUBLOC_FLAGS_DELETED)) && ($location['deleted']))) {
|
|| ((! ($r[0]['hubloc_flags'] & HUBLOC_FLAGS_DELETED)) && ($location['deleted']))) {
|
||||||
$n = q("update hubloc set hubloc_flags = (hubloc_flags ^ %d), hubloc_updated = '%s' where hubloc_id = %d limit 1",
|
$n = q("update hubloc set hubloc_flags = (hubloc_flags ^ %d), hubloc_updated = '%s' where hubloc_id = %d limit 1",
|
||||||
|
Reference in New Issue
Block a user