]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/OStatusPlugin.php
Renew 1 day *before* the end, not 1 day *after*
[quix0rs-gnu-social.git] / plugins / OStatus / OStatusPlugin.php
index 0dace39db0a542da1031df2f40de0abe0560ee61..8cdc9c343a91b8a0ac3de490a7c6b93df805c765 100644 (file)
@@ -1351,4 +1351,19 @@ class OStatusPlugin extends Plugin
         }
         return true;
     }
+
+    public function onCronDaily()
+    {
+        try {
+            $sub = FeedSub::renewalCheck();
+        } catch (NoResultException $e) {
+            common_log(LOG_INFO, "There were no expiring feeds.");
+            return;
+        }
+
+        while ($sub->fetch()) {
+            common_log(LOG_INFO, "Renewing feed subscription\n\tExp.: {$sub->sub_end}\n\tFeed: {$sub->uri}\n\tHub:  {$sub->huburi}");
+            $sub->renew();
+        }
+    }
 }