From 8ab98b72ac506f559cdc66b1a6689dcba1b18b00 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 13 Jan 2016 20:01:00 +0100 Subject: [PATCH] getLeaseRemaining for FeedSub too --- plugins/OStatus/classes/FeedSub.php | 8 ++++++++ plugins/OStatus/scripts/resub-feed.php | 2 ++ 2 files changed, 10 insertions(+) diff --git a/plugins/OStatus/classes/FeedSub.php b/plugins/OStatus/classes/FeedSub.php index ad2c4ed684..72746e9b90 100644 --- a/plugins/OStatus/classes/FeedSub.php +++ b/plugins/OStatus/classes/FeedSub.php @@ -108,6 +108,14 @@ class FeedSub extends Managed_DataObject return $this->uri; } + function getLeaseRemaining() + { + if (empty($this->sub_end)) { + return null; + } + return strtotime($this->sub_end) - time(); + } + /** * Do we have a hub? Then we are a PuSH feed. * https://en.wikipedia.org/wiki/PubSubHubbub diff --git a/plugins/OStatus/scripts/resub-feed.php b/plugins/OStatus/scripts/resub-feed.php index d5d0924fbf..37b09883db 100755 --- a/plugins/OStatus/scripts/resub-feed.php +++ b/plugins/OStatus/scripts/resub-feed.php @@ -81,6 +81,8 @@ function showSub($sub) print " Verify token: $sub->verify_token\n"; print " Signature secret: $sub->secret\n"; print " Sub start date: $sub->sub_start\n"; + print " Sub end date: $sub->sub_end\n"; + print " Sub lease remaining: {$sub->getLeaseRemaining()}\n"; print " Record created: $sub->created\n"; print " Record modified: $sub->modified\n"; } -- 2.39.5