From: Stephen Paul Weber Date: Wed, 21 Oct 2015 01:10:48 +0000 (+0000) Subject: Actually use the renew code X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=df46f123dd656545c80821931f0a384f7dc5d608;p=quix0rs-gnu-social.git 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. --- 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(); + } + } }