diff options
author | Mario Vavti <mario@mariovavti.com> | 2021-09-30 12:09:50 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2021-09-30 12:09:50 +0200 |
commit | 5cb5ecdb545d699eb0cbbed33797d0b4c234aadf (patch) | |
tree | 62f175fb0922c8d360c200d0d163cb4e12e569ea | |
parent | 44fa5ac9a1afabb53b9bfff4bd2f3fb7bef2b18d (diff) | |
download | volse-hubzilla-5cb5ecdb545d699eb0cbbed33797d0b4c234aadf.tar.gz volse-hubzilla-5cb5ecdb545d699eb0cbbed33797d0b4c234aadf.tar.bz2 volse-hubzilla-5cb5ecdb545d699eb0cbbed33797d0b4c234aadf.zip |
implement channel purge daemon and send a notifier purge_all message if the xchan was deleted
-rw-r--r-- | include/channel.php | 12 |
1 files 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 |