diff options
author | friendica <info@friendica.com> | 2013-09-17 20:50:09 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-09-17 20:50:09 -0700 |
commit | ff2ada207a7c90f095d1fad1513440eb08d3840a (patch) | |
tree | 75a0388384a44416c0e18cdb418b113ac5bbb8af /include/Contact.php | |
parent | 7f4b865c2bbdf481fa94639518026d70a8bf9492 (diff) | |
download | volse-hubzilla-ff2ada207a7c90f095d1fad1513440eb08d3840a.tar.gz volse-hubzilla-ff2ada207a7c90f095d1fad1513440eb08d3840a.tar.bz2 volse-hubzilla-ff2ada207a7c90f095d1fad1513440eb08d3840a.zip |
Pieces we'll need to tie together chanman and account/channel deletion and directory sync. Please do not mess with any of this.
Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this. Please do not mess with any of this.
OK? Understood?
Diffstat (limited to 'include/Contact.php')
-rw-r--r-- | include/Contact.php | 59 |
1 files changed, 44 insertions, 15 deletions
diff --git a/include/Contact.php b/include/Contact.php index 46d356f3f..b9e879bcf 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -147,7 +147,9 @@ function user_remove($uid) { } -function account_remove($account_id) { +function account_remove($account_id,$local = true) { + + logger('account_remove: ' . $account_id); if(! intval($account_id)) { logger('account_remove: no account.'); @@ -179,7 +181,7 @@ function account_remove($account_id) { ); if($x) { foreach($x as $xx) { - channel_remove($xx['channel_id']); + channel_remove($xx['channel_id'],$local); } } @@ -191,7 +193,7 @@ function account_remove($account_id) { } -function channel_remove($channel_id) { +function channel_remove($channel_id, $local = true) { if(! $channel_id) return; @@ -199,13 +201,38 @@ function channel_remove($channel_id) { logger('Removing channel: ' . $channel_id); $r = q("select * from channel where channel_id = %d limit 1", intval($channel_id)); + if(! $r) { + logger('channel_remove: channel not found: ' . $channel_id); + return; + } + + $channel = $r[0]; call_hooks('channel_remove',$r[0]); + if(! $local) { + // FIXME notify the directory // FIXME notify all contacts + $r = q("update channel set channel_pageflags = (channel_pageflags | %d), channel_r_stream = 0, channel_r_profile = 0, + channel_r_photos = 0, channel_r_abook = 0, channel_w_stream = 0, channel_w_wall = 0, channel_w_tagwall = 0, + channel_w_comment = 0, channel_w_mail = 0, channel_w_photos = 0, channel_w_chat = 0, channel_a_delegate = 0, + channel_r_storage = 0, channel_w_storage = 0, channel_r_pages = 0, channel_w_pages = 0 where channel_id = %d limit 1", + intval(PAGE_REMOVED), + intval($channel_id) + ); + + $r = q("update hubloc set hubloc_flags = hubloc_flags | %d where hubloc_hash = '%s'", + intval(HUBLOC_FLAGS_DELETED), + dbesc($channel['channel_hash']) + ); + + proc_run('php','include/notifier.php','purge_all',$channel_id); + + + } q("DELETE FROM `group` WHERE `uid` = %d", intval($channel_id)); q("DELETE FROM `group_member` WHERE `uid` = %d", intval($channel_id)); @@ -278,18 +305,20 @@ function remove_all_xchan_resources($xchan, $channel_id = 0) { ); - $r = q("delete from xchan where xchan_hash = '%s' limit 1", - dbesc($xchan) - ); - $r = q("delete from hubloc where hubloc_hash = '%s'", - dbesc($xchan) - ); - $r = q("delete from abook where abook_xchan = '%s'", - dbesc($xchan) - ); - $r = q("delete from xtag where xtag_hash = '%s'", - dbesc($xchan) - ); +// This could get sticky with directories + +// $r = q("delete from xchan where xchan_hash = '%s' limit 1", +// dbesc($xchan) +// ); +// $r = q("delete from hubloc where hubloc_hash = '%s'", +// dbesc($xchan) +// ); +// $r = q("delete from abook where abook_xchan = '%s'", +// dbesc($xchan) +// ); +// $r = q("delete from xtag where xtag_hash = '%s'", +// dbesc($xchan) +// ); } } |