diff options
author | Evan Prodromou <evan@status.net> | 2010-03-31 15:02:19 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-03-31 15:02:19 -0400 |
commit | c1c7feedbd11cc291a0fb68ea8c4d322eb8bf538 (patch) | |
tree | f1b803a46909cfba2f25d33df544ad817205beb2 /classes | |
parent | f19b95d9b7daa82e73ca2ebf23ca55712de73107 (diff) |
do complete unsubscribe process when deleting a user
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Profile.php | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/classes/Profile.php b/classes/Profile.php index eded1ff71..5de35c191 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -577,11 +577,41 @@ class Profile extends Memcached_DataObject { $sub = new Subscription(); $sub->subscriber = $this->id; - $sub->delete(); + + $sub->find(); + + while ($sub->fetch()) { + $other = Profile::staticGet('id', $sub->subscribed); + if (empty($other)) { + continue; + } + if ($other->id == $this->id) { + continue; + } + Subscription::cancel($this, $other); + } $subd = new Subscription(); $subd->subscribed = $this->id; - $subd->delete(); + $subd->find(); + + while ($subd->fetch()) { + $other = Profile::staticGet('id', $subd->subscriber); + if (empty($other)) { + continue; + } + if ($other->id == $this->id) { + continue; + } + Subscription::cancel($other, $this); + } + + $self = new Subscription(); + + $self->subscriber = $this->id; + $self->subscribed = $this->id; + + $self->delete(); } function _deleteMessages() |