From 437b0cb16ee12d9771e873f7c2c6a841654e03c2 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 17 Jul 2014 15:53:07 -0700 Subject: collection sync issue --- include/zot.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'include') diff --git a/include/zot.php b/include/zot.php index e00f54a17..fde1f9594 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2337,6 +2337,31 @@ function process_channel_sync_delivery($sender,$arr,$deliveries) { dbesc($cl['name']) ); } + + // now look for any collections locally which weren't in the list we just received. + // They need to be removed by marking deleted and removing the members. + // This shouldn't happen except for clones created before this function was written. + + if($x) { + $found_local = false; + foreach($x as $y) { + foreach($arr['collections'] as $cl) { + if($cl['collection'] == $y['hash']) { + $found_local = true; + break; + } + } + if(! $found_local) { + q("delete from group_member where gid = %d", + intval($y['id']) + ); + q("update groups set deleted = 1 where id = %d and uid = %d limit 1", + intval($y['id']), + intval($channel['channel_id']) + ); + } + } + } } // reload the group list with any updates -- cgit v1.2.3