From df46f123dd656545c80821931f0a384f7dc5d608 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 21 Oct 2015 01:10:48 +0000 Subject: [PATCH] Actually use the renew code 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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 0dace39db0..8cdc9c343a 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -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(); + } + } }