From 8c2113f9e6eb86b630a4e861513229d7abf219b8 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 1 Jan 2018 20:34:06 +0100 Subject: Add mute strategy configuration (#1750) --- app/Controllers/feedController.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'app/Controllers/feedController.php') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index fff20f798..2793577d5 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -24,6 +24,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { Minz_Error::error(403); } } + $this->updateTTL(); } /** @@ -282,11 +283,11 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $mtime = 0; $ttl = $feed->ttl(); - if ($ttl == -1) { + if ($ttl < FreshRSS_Feed::TTL_DEFAULT) { continue; //Feed refresh is disabled } if ((!$simplePiePush) && (!$feed_id) && - ($feed->lastUpdate() + 10 >= time() - ($ttl == -2 ? FreshRSS_Context::$user_conf->ttl_default : $ttl))) { + ($feed->lastUpdate() + 10 >= time() - ($ttl == FreshRSS_Feed::TTL_DEFAULT ? FreshRSS_Context::$user_conf->ttl_default : $ttl))) { //Too early to refresh from source, but check whether the feed was updated by another user $mtime = $feed->cacheModifiedTime(); if ($feed->lastUpdate() + 10 >= $mtime) { @@ -639,4 +640,14 @@ class FreshRSS_feed_Controller extends Minz_ActionController { Minz_Request::bad(_t('feedback.sub.feed.error'), $redirect_url); } } + + /** + * This method update TTL values for feeds if needed. + * It changes the old default value (-2) to the new default value (0). + * It changes the old disabled value (-1) to the default disabled value. + */ + private function updateTTL() { + $feedDAO = FreshRSS_Factory::createFeedDao(); + $feedDAO->updateTTL(); + } } -- cgit v1.2.3