From 6f20b74dc7b3b69365bf8de7ba0652177e570437 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 1 Mar 2010 13:41:06 -0500 Subject: [PATCH] drop tokens for OMB on unsubscribe --- classes/Subscription.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/classes/Subscription.php b/classes/Subscription.php index d6fb3fcbdd..878ab83e63 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) { -- 2.39.5