]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
getLeaseRemaining for FeedSub too
authorMikael Nordfeldth <mmn@hethane.se>
Wed, 13 Jan 2016 19:01:00 +0000 (20:01 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Wed, 13 Jan 2016 19:01:00 +0000 (20:01 +0100)
plugins/OStatus/classes/FeedSub.php
plugins/OStatus/scripts/resub-feed.php

index ad2c4ed68434f0a504d81bae056305ec83c31062..72746e9b90dd76588e086613de0d9125eac5dee4 100644 (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
index d5d0924fbfe3fe7330df4f49f543c20d175a8368..37b09883db428a4c7380e03068278e650ddb42a6 100755 (executable)
@@ -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";
 }