summaryrefslogtreecommitdiff
path: root/classes/Profile.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-31 12:47:42 -0700
committerBrion Vibber <brion@pobox.com>2010-03-31 12:47:42 -0700
commit3ed88938b95804ecadc62ed3a5f61a0863e2ff78 (patch)
treedcbcd646c22613400b49af09e9db5175627cd138 /classes/Profile.php
parent0841fa712ec558d283f533690d2db50dfa1da8fc (diff)
parentd3f995846b2a849bc53eb965eb2607d8d1d6dd34 (diff)
Merge branch 'master' of git@gitorious.org:statusnet/mainline into testing
Diffstat (limited to 'classes/Profile.php')
-rw-r--r--classes/Profile.php34
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()