diff options
author | Evan Prodromou <evan@status.net> | 2010-03-01 13:41:06 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-03-01 13:41:06 -0500 |
commit | 6f20b74dc7b3b69365bf8de7ba0652177e570437 (patch) | |
tree | 52b4382aab8d1b061d9aa768dda2e1b090c52975 | |
parent | caab6ddaa9ba9d8eb500d508e7580222886c0143 (diff) |
drop tokens for OMB on unsubscribe
-rw-r--r-- | classes/Subscription.php | 20 |
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) { |