From 5cb5ecdb545d699eb0cbbed33797d0b4c234aadf Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 30 Sep 2021 12:09:50 +0200 Subject: implement channel purge daemon and send a notifier purge_all message if the xchan was deleted --- include/channel.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/include/channel.php b/include/channel.php index 53b781eb6..ca6d01498 100644 --- a/include/channel.php +++ b/include/channel.php @@ -2825,13 +2825,6 @@ function channel_remove($channel_id, $local = true, $unset_session = false) { } } - $r = q("select id from item where uid = %d", intval($channel_id)); - if($r) { - foreach($r as $rv) { - drop_item($rv['id'],false); - } - } - q("delete from abook where abook_xchan = '%s' and abook_self = 1 ", dbesc($channel['channel_hash']) ); @@ -2841,6 +2834,9 @@ function channel_remove($channel_id, $local = true, $unset_session = false) { intval($channel_id) ); + // remove items + Master::Summon([ 'Channel_purge', $channel_id ]); + // if this was the default channel, set another one as default if(App::$account['account_default_channel'] == $channel_id) { $r = q("select channel_id from channel where channel_account_id = %d and channel_removed = 0 limit 1", @@ -2881,6 +2877,8 @@ function channel_remove($channel_id, $local = true, $unset_session = false) { $r = q("UPDATE xchan SET xchan_deleted = 1 WHERE xchan_hash = '%s'", dbesc($channel['channel_hash']) ); + // send a cleanup message to other servers + Master::Summon([ 'Notifier', 'purge_all', $channel_id ]); } //remove from file system -- cgit v1.2.3