per-feed update intervals
This commit is contained in:
parent
1cae701741
commit
d148926e2b
24
backend.php
24
backend.php
|
@ -693,10 +693,15 @@
|
|||
if ($subop == "editSave") {
|
||||
$feed_title = db_escape_string($_GET["t"]);
|
||||
$feed_link = db_escape_string($_GET["l"]);
|
||||
$upd_intl = db_escape_string($_GET["ui"]);
|
||||
$feed_id = $_GET["id"];
|
||||
|
||||
if (strtoupper($upd_intl) == "DEFAULT")
|
||||
$upd_intl = 0;
|
||||
|
||||
$result = db_query($link, "UPDATE ttrss_feeds SET
|
||||
title = '$feed_title', feed_url = '$feed_link' WHERE id = '$feed_id'");
|
||||
title = '$feed_title', feed_url = '$feed_link',
|
||||
update_interval = '$upd_intl' WHERE id = '$feed_id'");
|
||||
|
||||
}
|
||||
|
||||
|
@ -743,14 +748,16 @@
|
|||
</table>";
|
||||
|
||||
$result = db_query($link, "SELECT
|
||||
id,title,feed_url,substring(last_updated,1,16) as last_updated
|
||||
id,title,feed_url,substring(last_updated,1,16) as last_updated,
|
||||
update_interval
|
||||
FROM
|
||||
ttrss_feeds ORDER by title");
|
||||
|
||||
print "<p><table width=\"100%\" class=\"prefFeedList\" id=\"prefFeedList\">";
|
||||
print "<tr class=\"title\">
|
||||
<td> </td><td>Select</td><td width=\"40%\">Title</td>
|
||||
<td width=\"40%\">Link</td><td>Last updated</td></tr>";
|
||||
<td width=\"30%\">Link</td><td width=\"10%\">Update Interval</td>
|
||||
<td>Last updated</td></tr>";
|
||||
|
||||
$lnum = 0;
|
||||
|
||||
|
@ -788,6 +795,11 @@
|
|||
print "<td><a href=\"javascript:editFeed($feed_id);\">" .
|
||||
$line["feed_url"] . "</td>";
|
||||
|
||||
if ($line["update_interval"] == "0")
|
||||
$line["update_interval"] = "Default";
|
||||
|
||||
print "<td>" . $line["update_interval"] . "</td>";
|
||||
|
||||
|
||||
} else if ($feed_id != $edit_feed_id) {
|
||||
|
||||
|
@ -797,12 +809,18 @@
|
|||
print "<td>".$line["title"]."</td>";
|
||||
print "<td>".$line["feed_url"]."</td>";
|
||||
|
||||
if ($line["update_interval"] == "0")
|
||||
$line["update_interval"] = "Default";
|
||||
|
||||
print "<td>" . $line["update_interval"] . "</td>";
|
||||
|
||||
} else {
|
||||
|
||||
print "<td><input disabled=\"true\" type=\"checkbox\"></td>";
|
||||
|
||||
print "<td><input id=\"iedit_title\" value=\"".$line["title"]."\"></td>";
|
||||
print "<td><input id=\"iedit_link\" value=\"".$line["feed_url"]."\"></td>";
|
||||
print "<td><input id=\"iedit_updintl\" value=\"".$line["update_interval"]."\"></td>";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -30,5 +30,7 @@
|
|||
// crafted SQL queries. This feature is highly experimental and
|
||||
// at this point not user friendly. Use with caution.
|
||||
|
||||
define(MIN_UPDATE_INTERVAL, 30);
|
||||
// min. interval between feed updates, minutes
|
||||
?>
|
||||
|
||||
|
|
|
@ -24,12 +24,20 @@
|
|||
|
||||
db_query($link, "BEGIN");
|
||||
|
||||
$result = db_query($link, "SELECT feed_url,id,last_updated FROM ttrss_feeds");
|
||||
$result = db_query($link, "SELECT feed_url,id,
|
||||
substring(last_updated,1,19) as last_updated,
|
||||
update_interval FROM ttrss_feeds");
|
||||
|
||||
while ($line = db_fetch_assoc($result)) {
|
||||
// if (!$line["last_updated"] || time() - strtotime($line["last_updated"]) > 1800) {
|
||||
$upd_intl = $line["update_interval"];
|
||||
|
||||
if (!$upd_intl) $upd_intl = MIN_UPDATE_INTERVAL;
|
||||
|
||||
if (!$line["last_updated"] ||
|
||||
time() - strtotime($line["last_updated"]) > ($upd_intl * 60)) {
|
||||
|
||||
update_rss_feed($link, $line["feed_url"], $line["id"]);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
purge_old_posts($link);
|
||||
|
|
10
prefs.js
10
prefs.js
|
@ -454,9 +454,16 @@ function feedEditSave() {
|
|||
|
||||
var link = document.getElementById("iedit_link").value;
|
||||
var title = document.getElementById("iedit_title").value;
|
||||
var upd_intl = document.getElementById("iedit_updintl").value;
|
||||
|
||||
// notify("Saving feed.");
|
||||
|
||||
if (upd_intl < 0) {
|
||||
notify("Update interval must be >= 0 (0 = default)");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (link.length == 0) {
|
||||
notify("Feed link cannot be blank.");
|
||||
return;
|
||||
|
@ -470,7 +477,8 @@ function feedEditSave() {
|
|||
active_feed = false;
|
||||
|
||||
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editSave&id=" +
|
||||
feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) ,true);
|
||||
feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) +
|
||||
"&ui=" + param_escape(upd_intl), true);
|
||||
xmlhttp.onreadystatechange=feedlist_callback;
|
||||
xmlhttp.send(null);
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ create table ttrss_feeds (id integer not null auto_increment primary key,
|
|||
title varchar(200) not null unique,
|
||||
feed_url varchar(250) unique not null,
|
||||
icon_url varchar(250) not null default '',
|
||||
update_interval integer not null default 0,
|
||||
last_updated datetime default '') TYPE=InnoDB;
|
||||
|
||||
insert into ttrss_feeds (title,feed_url) values ('Footnotes', 'http://gnomedesktop.org/node/feed');
|
||||
|
|
|
@ -6,6 +6,7 @@ create table ttrss_feeds (id serial not null primary key,
|
|||
title varchar(200) not null unique,
|
||||
feed_url varchar(250) unique not null,
|
||||
icon_url varchar(250) not null default '',
|
||||
update_interval integer not null default 0,
|
||||
last_updated timestamp default null);
|
||||
|
||||
insert into ttrss_feeds (title,feed_url) values ('Footnotes', 'http://gnomedesktop.org/node/feed');
|
||||
|
|
|
@ -204,7 +204,7 @@ a:hover {
|
|||
opacity : 0.8;
|
||||
}
|
||||
|
||||
#iedit_title, #iedit_link, #iedit_regexp, #iedit_descr, #iedit_expr {
|
||||
#iedit_title, #iedit_link, #iedit_regexp, #iedit_descr, #iedit_expr, #iedit_updintl {
|
||||
width : 100%;
|
||||
padding-left : 2px;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue