force refetch feed when clicking update/clicking on same feed in the tree
This commit is contained in:
parent
56b2a4095b
commit
c0c2abbaa7
|
@ -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") {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -184,7 +184,7 @@
|
|||
</select>
|
||||
|
||||
<button dojoType="dijit.form.Button" name="update"
|
||||
onclick="scheduleFeedUpdate()">
|
||||
onclick="viewCurrentFeed()">
|
||||
<?php echo __('Update') ?></button>
|
||||
|
||||
<button dojoType="dijit.form.Button"
|
||||
|
|
|
@ -137,11 +137,11 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
|
|||
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);
|
||||
|
|
|
@ -149,7 +149,11 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req) {
|
|||
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) {
|
||||
|
@ -165,6 +169,10 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req) {
|
|||
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");
|
||||
|
|
39
js/tt-rss.js
39
js/tt-rss.js
|
@ -1040,45 +1040,6 @@ function reverseHeadlineOrder() {
|
|||
}
|
||||
}
|
||||
|
||||
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";
|
||||
|
|
Loading…
Reference in New Issue