summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-07-18 00:37:35 -0400
committerEvan Prodromou <evan@prodromou.name>2008-07-18 00:37:35 -0400
commit71dfc0d983c4be2e13eac6f52a1a4860db1968fd (patch)
tree4f54dc7b0bf44de535e391524fc4aa08a6e6efbf /actions
parent310d02ae40e0601db6d27c05ef53aedb4767bd4a (diff)
when in doubt, start throwing transactions around
darcs-hash:20080718043735-84dde-8c74ccaf2560716209b8518e77e6a0f357d881af.gz
Diffstat (limited to 'actions')
-rw-r--r--actions/twitapifriendships.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/actions/twitapifriendships.php b/actions/twitapifriendships.php
index 1ea8199e9..c603761a2 100644
--- a/actions/twitapifriendships.php
+++ b/actions/twitapifriendships.php
@@ -45,6 +45,9 @@ class TwitapifriendshipsAction extends TwitterapiAction {
}
$sub = new Subscription();
+
+ $sub->query('BEGIN');
+
$sub->subscriber = $user->id;
$sub->subscribed = $other->id;
@@ -56,6 +59,8 @@ class TwitapifriendshipsAction extends TwitterapiAction {
return;
}
+ $sub->query('COMMIT');
+
mail_subscribe_notify($other, $user);
$type = $apidata['content-type'];
@@ -91,7 +96,9 @@ class TwitapifriendshipsAction extends TwitterapiAction {
$sub->subscribed = $other->id;
if ($sub->fetch(TRUE)) {
+ $sub->query('BEGIN');
$sub->delete();
+ $sub->query('COMMIT');
}
$type = $apidata['content-type'];