aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/feedController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2018-02-24 12:02:16 +0100
committerGravatar GitHub <noreply@github.com> 2018-02-24 12:02:16 +0100
commit5ebeb9e3e5d46195a83211140c1d28d58be19b2a (patch)
tree6b93ae52a1206b6045087f893dde67a04b4e1bda /app/Controllers/feedController.php
parent889888f20eb6f3dd476b78c0f59672f7c7962354 (diff)
parent294f9336ad0f315574c74d6b527b1bb8a280f3c6 (diff)
Merge pull request #1786 from FreshRSS/dev1.10.0
FreshRSS 1.10.0
Diffstat (limited to 'app/Controllers/feedController.php')
-rwxr-xr-xapp/Controllers/feedController.php23
1 files changed, 17 insertions, 6 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index fff20f798..7f66b10db 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();
}
/**
@@ -44,6 +45,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$catDAO = new FreshRSS_CategoryDAO();
+ $url = trim($url);
+
$cat = null;
if ($new_cat_name != '') {
$new_cat_id = $catDAO->addCategory(array('name' => $new_cat_name));
@@ -282,11 +285,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) {
@@ -316,10 +319,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$feed_history = $feed->keepHistory();
if ($isNewFeed) {
- $feed_history = -1; //∞
- } elseif ($feed_history == -2) {
- // TODO: -2 must be a constant!
- // -2 means we take the default value from configuration
+ $feed_history = FreshRSS_Feed::KEEP_HISTORY_INFINITE;
+ } elseif (FreshRSS_Feed::KEEP_HISTORY_DEFAULT === $feed_history) {
$feed_history = FreshRSS_Context::$user_conf->keep_history_default;
}
$needFeedCacheRefresh = false;
@@ -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();
+ }
}