X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FUser.php;h=7ab9f307aeb40cbcb71966e33a9b8233fdeee351;hb=8516c4eef0f5c1a5d1a0a1a6c077475875eed297;hp=6c1f149e4ded31fca07627ab0c16210e63ece717;hpb=8b65883f9ddf1cb1b7bdec323722da351fa0cb69;p=quix0rs-gnu-social.git diff --git a/classes/User.php b/classes/User.php index 6c1f149e4d..7ab9f307ae 100644 --- a/classes/User.php +++ b/classes/User.php @@ -1,7 +1,7 @@ . */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -443,7 +443,7 @@ class User extends Memcached_DataObject 'SELECT notice.* ' . 'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' . 'WHERE subscription.subscriber = %d ' . - 'AND notice.is_local != ' . NOTICE_GATEWAY; + 'AND notice.is_local != ' . Notice::GATEWAY; return Notice::getStream(sprintf($qry, $this->id), 'user:notices_with_friends:' . $this->id, $offset, $limit, $since_id, $before_id, @@ -685,4 +685,48 @@ class User extends Memcached_DataObject { return Design::staticGet('id', $this->design_id); } + + 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? + } }