]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
when in doubt, start throwing transactions around
authorEvan Prodromou <evan@prodromou.name>
Fri, 18 Jul 2008 04:37:35 +0000 (00:37 -0400)
committerEvan Prodromou <evan@prodromou.name>
Fri, 18 Jul 2008 04:37:35 +0000 (00:37 -0400)
darcs-hash:20080718043735-84dde-8c74ccaf2560716209b8518e77e6a0f357d881af.gz

actions/twitapifriendships.php

index 1ea8199e9ce63bc8ffdced33ccd87e282354aa29..c603761a2ba997985ed612a1818470f47da25a51 100644 (file)
@@ -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'];