]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Actually use the renew code
authorStephen Paul Weber <singpolyma@singpolyma.net>
Wed, 21 Oct 2015 01:10:48 +0000 (01:10 +0000)
committerStephen Paul Weber <singpolyma@singpolyma.net>
Wed, 21 Oct 2015 01:10:48 +0000 (01:10 +0000)
We have the code to check once a day and renew, but currently it's
just in a script directory.  This change adds an event listener
hook to check and renew subscriptions daily.

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();
+        }
+    }
 }