diff options
author | Sarven Capadisli <csarven@status.net> | 2009-10-04 11:12:42 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@status.net> | 2009-10-04 11:12:42 +0000 |
commit | 54e8f583ace8d22291f3bb42d2fb6556517d3ab6 (patch) | |
tree | 0514cb3cd965660b7ba4a3379e6ae5bf261d298c /classes/User.php | |
parent | f344a49b11607d4dbb64ab6935237cd5185a06b4 (diff) | |
parent | affe00276a008038e8a8b37b3812215e382fe98e (diff) |
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x-mobile
Diffstat (limited to 'classes/User.php')
-rw-r--r-- | classes/User.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/classes/User.php b/classes/User.php index 3f7ed09bb..48df0cdd7 100644 --- a/classes/User.php +++ b/classes/User.php @@ -740,4 +740,48 @@ class User extends Memcached_DataObject } return $result; } + + function delete() + { + $profile = $this->getProfile(); + $profile->delete(); + + $related = array('Fave', + 'User_openid', + 'Confirm_address', + 'Remember_me', + 'Foreign_link', + 'Invitation', + ); + + if (common_config('inboxes', 'enabled')) { + $related[] = 'Notice_inbox'; + } + + foreach ($related as $cls) { + $inst = new $cls(); + $inst->user_id = $this->id; + $inst->delete(); + } + + $this->_deleteTags(); + $this->_deleteBlocks(); + + parent::delete(); + } + + function _deleteTags() + { + $tag = new Profile_tag(); + $tag->tagger = $this->id; + $tag->delete(); + } + + function _deleteBlocks() + { + $block = new Profile_block(); + $block->blocker = $this->id; + $block->delete(); + // XXX delete group block? Reset blocker? + } } |