\r
$method_split = explode(":", $method);\r
\r
- if ($method == "ForceUpdate" && $feed && is_numeric($feed) > 0) {\r
- include "rssfuncs.php";\r
- update_rss_feed($this->link, $feed, true);\r
+ if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) {\r
+ // Update the feed if required with some basic flood control\r
+\r
+ $result = db_query($this->link,\r
+ "SELECT ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated\r
+ FROM ttrss_feeds WHERE id = '$feed'");\r
+\r
+ if (db_num_rows($result) != 0) {\r
+ $last_updated = strtotime(db_fetch_result($result, 0, "last_updated"));\r
+ if (time() - $last_updated > 120) {\r
+ include "rssfuncs.php";\r
+ update_rss_feed($this->link, $feed, true, true);\r
+ }\r
+ }\r
}\r
\r
if ($method_split[0] == "MarkAllReadGR") {\r
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);
$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);
</select>
<button dojoType="dijit.form.Button" name="update"
- onclick="scheduleFeedUpdate()">
+ onclick="viewCurrentFeed()">
<?php echo __('Update') ?></button>
<button dojoType="dijit.form.Button"
editFeed(this.getParent().row_id, false);
}}));
- menu.addChild(new dijit.MenuItem({
+ /* menu.addChild(new dijit.MenuItem({
label: __("Update feed"),
onClick: function() {
- scheduleFeedUpdate(this.getParent().row_id, false);
- }}));
+ heduleFeedUpdate(this.getParent().row_id, false);
+ }})); */
}
menu.bindDomNode(tnode.domNode);
var toolbar_query = Form.serialize("main_toolbar_form");
var query = "?op=feeds&method=view&feed=" + feed + "&" +
- toolbar_query + "&m=" + param_escape(method);
+ toolbar_query;
+
+ if (method) {
+ query = query + "&m=" + param_escape(method);
+ }
if (!background) {
if (_search_query) {
if (vgroup_last_feed) {
query = query + "&vgrlf=" + param_escape(vgroup_last_feed);
}
+ } else {
+ if (!method && !is_cat && feed == getActiveFeedId()) {
+ query = query + "&m=ForceUpdate";
+ }
}
Form.enable("main_toolbar_form");
}
}
-function scheduleFeedUpdate(id, is_cat) {
- try {
- if (!id) {
- id = getActiveFeedId();
- is_cat = activeFeedIsCat();
- }
-
- if (!id) {
- alert(__("Please select some feed first."));
- return;
- }
-
- var query = "?op=rpc&method=scheduleFeedUpdate&id=" +
- param_escape(id) +
- "&is_cat=" + param_escape(is_cat);
-
- console.log(query);
-
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function(transport) {
- handle_rpc_json(transport);
-
- var reply = JSON.parse(transport.responseText);
- var message = reply['message'];
-
- if (message) {
- notify_info(message);
- return;
- }
-
- } });
-
-
- } catch (e) {
- exception_error("scheduleFeedUpdate", e);
- }
-}
-
function newVersionDlg() {
try {
var query = "backend.php?op=dlg&method=newVersion";