diff options
author | Brion Vibber <brion@pobox.com> | 2010-02-11 00:09:20 +0000 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-02-11 00:09:20 +0000 |
commit | 71151b2583d81e28c5f5d42a690c649f4e84f3bf (patch) | |
tree | 4b2461f04a0ee9ec4f4b25677186403657a58c3e /plugins/OStatus/actions/pushcallback.php | |
parent | 4ae760cb62657e68b6b2313e64d2bb59fe264df4 (diff) |
OStatus: garbage collect unused PuSH subscriptions when the last local subscriber unsubs
Diffstat (limited to 'plugins/OStatus/actions/pushcallback.php')
-rw-r--r-- | plugins/OStatus/actions/pushcallback.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/plugins/OStatus/actions/pushcallback.php b/plugins/OStatus/actions/pushcallback.php index a5e02e08f..471d079ab 100644 --- a/plugins/OStatus/actions/pushcallback.php +++ b/plugins/OStatus/actions/pushcallback.php @@ -91,15 +91,20 @@ class PushCallbackAction extends Action #} // OK! - common_log(LOG_INFO, __METHOD__ . ': sub confirmed'); - $feedinfo->sub_start = common_sql_date(time()); - if ($lease_seconds > 0) { - $feedinfo->sub_end = common_sql_date(time() + $lease_seconds); + if ($mode == 'subscribe') { + common_log(LOG_INFO, __METHOD__ . ': sub confirmed'); + $feedinfo->sub_start = common_sql_date(time()); + if ($lease_seconds > 0) { + $feedinfo->sub_end = common_sql_date(time() + $lease_seconds); + } else { + $feedinfo->sub_end = null; + } + $feedinfo->update(); } else { - $feedinfo->sub_end = null; + common_log(LOG_INFO, __METHOD__ . ": unsub confirmed; deleting sub record for $topic"); + $feedinfo->delete(); } - $feedinfo->update(); - + print $challenge; } } |