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.
This commit is contained in:
Stephen Paul Weber 2015-10-21 01:10:48 +00:00
parent 0ba53edd96
commit df46f123dd

View File

@ -1351,4 +1351,19 @@ class OStatusPlugin extends Plugin
} }
return true; 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();
}
}
} }