summaryrefslogtreecommitdiff
path: root/classes/Subscription.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-03-02 07:33:18 +0000
committerZach Copley <zach@status.net>2010-03-02 07:33:18 +0000
commit6c1321b108206d05b75703da22ea8abab82071bf (patch)
tree7380e7eb3f0ab121ea25413ddf6f847c8915fc2c /classes/Subscription.php
parentdbb9957eea1887265532dbae000fb1fc30005988 (diff)
parent40e1b249cf1535a6074c8b32e5820c8ad6427836 (diff)
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
Diffstat (limited to 'classes/Subscription.php')
-rw-r--r--classes/Subscription.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/classes/Subscription.php b/classes/Subscription.php
index d6fb3fcbd..9cef2df1a 100644
--- a/classes/Subscription.php
+++ b/classes/Subscription.php
@@ -172,6 +172,28 @@ 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;
+
+ if ($token->find(true)) {
+
+ $result = $token->delete();
+
+ if (!$result) {
+ common_log_db_error($token, 'DELETE', __FILE__);
+ throw new Exception(_('Couldn\'t delete subscription OMB token.'));
+ }
+ } else {
+ common_log(LOG_ERR, "Couldn't find credentials with token {$token->tok}");
+ }
+ }
+
$result = $sub->delete();
if (!$result) {