aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-07-17 15:53:07 -0700
committerfriendica <info@friendica.com>2014-07-17 15:53:07 -0700
commit437b0cb16ee12d9771e873f7c2c6a841654e03c2 (patch)
treeb8d78b15c4e634c3d24f670b5499e7023ed976ce
parent5d5dde174e1338e04abb79f5ae7a47f7fcb9af46 (diff)
downloadvolse-hubzilla-437b0cb16ee12d9771e873f7c2c6a841654e03c2.tar.gz
volse-hubzilla-437b0cb16ee12d9771e873f7c2c6a841654e03c2.tar.bz2
volse-hubzilla-437b0cb16ee12d9771e873f7c2c6a841654e03c2.zip
collection sync issue
-rw-r--r--include/zot.php25
1 files changed, 25 insertions, 0 deletions
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