summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-03-01 13:41:06 -0500
committerEvan Prodromou <evan@status.net>2010-03-01 18:03:17 -0500
commit320036dbfbd1d4b2b1e866aafb5da26330cc1e21 (patch)
treee21cc2e6b3ba944ba1d80ddf8236954ad499e241 /classes
parentd77248343f173d5a25e674abfc4bffe59d55300c (diff)
drop tokens for OMB on unsubscribe
Diffstat (limited to 'classes')
-rw-r--r--classes/Subscription.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/classes/Subscription.php b/classes/Subscription.php
index d6fb3fcbd..878ab83e6 100644
--- a/classes/Subscription.php
+++ b/classes/Subscription.php
@@ -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) {