diff --git a/classes/feeds.php b/classes/feeds.php
index 836bbb060..df206c2ef 100644
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -134,9 +134,20 @@ class Feeds extends Handler_Protected {
$method_split = explode(":", $method);
- if ($method == "ForceUpdate" && $feed && is_numeric($feed) > 0) {
- include "rssfuncs.php";
- update_rss_feed($this->link, $feed, true);
+ if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) {
+ // Update the feed if required with some basic flood control
+
+ $result = db_query($this->link,
+ "SELECT ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
+ FROM ttrss_feeds WHERE id = '$feed'");
+
+ if (db_num_rows($result) != 0) {
+ $last_updated = strtotime(db_fetch_result($result, 0, "last_updated"));
+ if (time() - $last_updated > 120) {
+ include "rssfuncs.php";
+ update_rss_feed($this->link, $feed, true, true);
+ }
+ }
}
if ($method_split[0] == "MarkAllReadGR") {
diff --git a/include/rssfuncs.php b/include/rssfuncs.php
index 09fd457b6..14fa5f348 100644
--- a/include/rssfuncs.php
+++ b/include/rssfuncs.php
@@ -269,7 +269,7 @@
define('MAGPIE_CACHE_AGE', $cache_age);
define('MAGPIE_CACHE_ON', !$no_cache);
- define('MAGPIE_FETCH_TIME_OUT', 60);
+ define('MAGPIE_FETCH_TIME_OUT', $no_cache ? 15 : 60);
define('MAGPIE_CACHE_DIR', CACHE_DIR . "/magpie");
$rss = @fetch_rss($fetch_url);
@@ -282,7 +282,7 @@
$rss = new SimplePie();
$rss->set_useragent(SELF_USER_AGENT);
-# $rss->set_timeout(10);
+ $rss->set_timeout($no_cache ? 15 : 60);
$rss->set_feed_url($fetch_url);
$rss->set_output_encoding('UTF-8');
//$rss->force_feed(true);
diff --git a/index.php b/index.php
index 4c4fa5415..09c4dc8c7 100644
--- a/index.php
+++ b/index.php
@@ -184,7 +184,7 @@