]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
drop tokens for OMB on unsubscribe
authorEvan Prodromou <evan@status.net>
Mon, 1 Mar 2010 18:41:06 +0000 (13:41 -0500)
committerEvan Prodromou <evan@status.net>
Mon, 1 Mar 2010 23:03:17 +0000 (18:03 -0500)
classes/Subscription.php

index d6fb3fcbdda82f17d70dcce6692868dfed6f1840..878ab83e633c54af93613f93d4f0c2808c78f277 100644 (file)
@@ -172,6 +172,26 @@ class Subscription extends Memcached_DataObject
 
             assert(!empty($sub));
 
+            // @todo: move this block to EndSubscribe handler for
+            // OMB plugin when it exists.
+
+            if (!empty($sub->token)) {
+
+                $token = new Token();
+
+                $token->tok    = $sub->token;
+                $token->secret = $sub->secret;
+
+                if ($token->find(true)) {
+
+                    $result = $token->delete();
+                    if (!$result) {
+                        common_log_db_error($sub, 'DELETE', __FILE__);
+                        throw new Exception(_('Couldn\'t delete subscription OMB token.'));
+                    }
+                }
+            }
+
             $result = $sub->delete();
 
             if (!$result) {