]> git.wh0rd.org - tt-rss.git/blobdiff - include/rssfuncs.php
Merge branch 'master' into tunable-fetches
[tt-rss.git] / include / rssfuncs.php
index 0c5a0153bfddc0cf3ee28303139ddb6a13a68dc0..ce197156c4603110d4c6c8d92f629fd16c5004ee 100644 (file)
@@ -77,6 +77,7 @@
                if (DB_TYPE == "pgsql") {
                        $update_limit_qpart = "AND ((
                                        ttrss_feeds.update_interval = 0
+                                       AND ttrss_user_prefs.value != '-1'
                                        AND ttrss_feeds.last_updated < NOW() - CAST((ttrss_user_prefs.value || ' minutes') AS INTERVAL)
                                ) OR (
                                        ttrss_feeds.update_interval > 0
@@ -86,6 +87,7 @@
                } else {
                        $update_limit_qpart = "AND ((
                                        ttrss_feeds.update_interval = 0
+                                       AND ttrss_user_prefs.value != '-1'
                                        AND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL CONVERT(ttrss_user_prefs.value, SIGNED INTEGER) MINUTE)
                                ) OR (
                                        ttrss_feeds.update_interval > 0
                        // since we have the data cached, we can deal with other feeds with the same url
 
                        $tmp_result = db_query($link, "SELECT ttrss_feeds.feed_url,ttrss_feeds.id,last_updated
-                       FROM ttrss_feeds, ttrss_users WHERE
-                               ttrss_users.id = ttrss_feeds.owner_uid AND
+                       FROM ttrss_feeds, ttrss_users, ttrss_user_prefs WHERE
+                               ttrss_user_prefs.owner_uid = ttrss_feeds.owner_uid AND
+                               ttrss_users.id = ttrss_user_prefs.owner_uid AND
+                               ttrss_user_prefs.pref_name = 'DEFAULT_UPDATE_INTERVAL' AND
                                feed_url = '".db_escape_string($link, $feed)."' AND
-                               ttrss_feeds.update_interval != -1
+                               (ttrss_feeds.update_interval > 0 OR
+                                       ttrss_user_prefs.value != '-1')
                                $login_thresh_qpart
                        ORDER BY feed_url $query_limit");
 
                                        _debug("update_rss_feed: fetching [$fetch_url] (ts: $cache_timestamp/$last_updated_timestamp)");
                                }
 
+                               $force_refetch = isset($_REQUEST["force_refetch"]);
+
                                $feed_data = fetch_file_contents($fetch_url, false,
-                                       $auth_login, $auth_pass, false, $no_cache ? 15 : 45,
-                                       max($last_updated_timestamp, $cache_timestamp));
+                                       $auth_login, $auth_pass, false, 
+                                       $no_cache ? FEED_FETCH_NO_CACHE_TIMEOUT : FEED_FETCH_TIMEOUT,
+                                       $force_refetch ? 0 : max($last_updated_timestamp, $cache_timestamp));
 
                                if ($debug_enabled) {
                                        _debug("update_rss_feed: fetch done.");
                        if ($filter_match) {
                                foreach ($filter["actions"] AS $action) {
                                        array_push($matches, $action);
+
+                                       // if Stop action encountered, perform no further processing
+                                       if ($action["type"] == "stop") return $matches;
                                }
                        }
                }