getLeaseRemaining for FeedSub too

This commit is contained in:
Mikael Nordfeldth 2016-01-13 20:01:00 +01:00
parent 377947c57f
commit 8ab98b72ac
2 changed files with 10 additions and 0 deletions

View File

@ -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

View File

@ -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";
}