diff options
author | friendica <info@friendica.com> | 2015-01-30 15:01:10 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2015-01-30 15:01:10 -0800 |
commit | 340212d77e246e2f46f0ae1efe5199bf01a858c8 (patch) | |
tree | cd1c24fb9f20c570eb490a93c47e57a925228b50 /include | |
parent | ef04d21a8f00d2b9623c7fc7f5a5b49f44a7f1d5 (diff) | |
download | volse-hubzilla-340212d77e246e2f46f0ae1efe5199bf01a858c8.tar.gz volse-hubzilla-340212d77e246e2f46f0ae1efe5199bf01a858c8.tar.bz2 volse-hubzilla-340212d77e246e2f46f0ae1efe5199bf01a858c8.zip |
sync_locations() toggle DB flag functions were broken - result of postgres changes. Split these into seperate set and reset blocks.
Diffstat (limited to 'include')
-rw-r--r-- | include/zot.php | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/include/zot.php b/include/zot.php index 6057bda52..04b6806c2 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1988,13 +1988,23 @@ function sync_locations($sender,$arr,$absolute = false) { } } - if((($r[0]['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) && (! $location['primary'])) - || ((! ($r[0]['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY)) && ($location['primary']))) { + if(($r[0]['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) && (! $location['primary'])) { $m = q("update hubloc set hubloc_flags = (hubloc_flags & ~%d), hubloc_updated = '%s' where hubloc_id = %d", intval(HUBLOC_FLAGS_PRIMARY), dbesc(datetime_convert()), intval($r[0]['hubloc_id']) ); + $r[0]['hubloc_flags'] = $r[0]['hubloc_flags'] ^ HUBLOC_FLAGS_PRIMARY; + hubloc_change_primary($r[0]); + $what .= 'primary_hub '; + $changed = true; + } + elseif((! ($r[0]['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY)) && ($location['primary'])) { + $m = q("update hubloc set hubloc_flags = (hubloc_flags | %d), hubloc_updated = '%s' where hubloc_id = %d", + intval(HUBLOC_FLAGS_PRIMARY), + dbesc(datetime_convert()), + intval($r[0]['hubloc_id']) + ); // make sure hubloc_change_primary() has current data $r[0]['hubloc_flags'] = $r[0]['hubloc_flags'] ^ HUBLOC_FLAGS_PRIMARY; hubloc_change_primary($r[0]); @@ -2009,8 +2019,7 @@ function sync_locations($sender,$arr,$absolute = false) { $changed = true; } } - if((($r[0]['hubloc_flags'] & HUBLOC_FLAGS_DELETED) && (! $location['deleted'])) - || ((! ($r[0]['hubloc_flags'] & HUBLOC_FLAGS_DELETED)) && ($location['deleted']))) { + if(($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", intval(HUBLOC_FLAGS_DELETED), dbesc(datetime_convert()), @@ -2019,6 +2028,15 @@ function sync_locations($sender,$arr,$absolute = false) { $what .= 'delete_hub '; $changed = true; } + elseif((! ($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", + intval(HUBLOC_FLAGS_DELETED), + dbesc(datetime_convert()), + intval($r[0]['hubloc_id']) + ); + $what .= 'delete_hub '; + $changed = true; + } continue; } |