per-feed purge intervals
This commit is contained in:
parent
430bf183c5
commit
5d73494a18
34
backend.php
34
backend.php
|
@ -816,14 +816,20 @@
|
|||
$feed_title = db_escape_string($_GET["t"]);
|
||||
$feed_link = db_escape_string($_GET["l"]);
|
||||
$upd_intl = db_escape_string($_GET["ui"]);
|
||||
$purge_intl = db_escape_string($_GET["pi"]);
|
||||
$feed_id = $_GET["id"];
|
||||
|
||||
if (strtoupper($upd_intl) == "DEFAULT")
|
||||
$upd_intl = 0;
|
||||
|
||||
if (strtoupper($purge_intl) == "DEFAULT")
|
||||
$purge_intl = 0;
|
||||
|
||||
$result = db_query($link, "UPDATE ttrss_feeds SET
|
||||
title = '$feed_title', feed_url = '$feed_link',
|
||||
update_interval = '$upd_intl' WHERE id = '$feed_id'");
|
||||
update_interval = '$upd_intl',
|
||||
purge_interval = '$purge_intl'
|
||||
WHERE id = '$feed_id'");
|
||||
|
||||
}
|
||||
|
||||
|
@ -892,14 +898,16 @@
|
|||
|
||||
$result = db_query($link, "SELECT
|
||||
id,title,feed_url,substring(last_updated,1,16) as last_updated,
|
||||
update_interval
|
||||
update_interval,purge_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=\"30%\">Link</td><td width=\"10%\">Update Interval</td>
|
||||
<td> </td><td>Select</td><td width=\"30%\">Title</td>
|
||||
<td width=\"30%\">Link</td>
|
||||
<td width=\"10%\">Update Interval</td>
|
||||
<td width=\"10%\">Purge Days</td>
|
||||
<td>Last updated</td></tr>";
|
||||
|
||||
$lnum = 0;
|
||||
|
@ -937,15 +945,21 @@
|
|||
type=\"checkbox\" id=\"FRCHK-".$line["id"]."\"></td>";
|
||||
|
||||
print "<td><a href=\"javascript:editFeed($feed_id);\">" .
|
||||
$edit_title . "</td>";
|
||||
$edit_title . "</a></td>";
|
||||
print "<td><a href=\"javascript:editFeed($feed_id);\">" .
|
||||
$edit_link . "</td>";
|
||||
$edit_link . "</a></td>";
|
||||
|
||||
if ($line["update_interval"] == "0")
|
||||
$line["update_interval"] = "Default";
|
||||
|
||||
print "<td>" . $line["update_interval"] . "</td>";
|
||||
print "<td><a href=\"javascript:editFeed($feed_id);\">" .
|
||||
$line["update_interval"] . "</a></td>";
|
||||
|
||||
if ($line["purge_interval"] == "0")
|
||||
$line["purge_interval"] = "Default";
|
||||
|
||||
print "<td><a href=\"javascript:editFeed($feed_id);\">" .
|
||||
$line["purge_interval"] . "</a></td>";
|
||||
|
||||
} else if ($feed_id != $edit_feed_id) {
|
||||
|
||||
|
@ -960,6 +974,11 @@
|
|||
|
||||
print "<td>" . $line["update_interval"] . "</td>";
|
||||
|
||||
if ($line["purge_interval"] == "0")
|
||||
$line["purge_interval"] = "Default";
|
||||
|
||||
print "<td>" . $line["purge_interval"] . "</td>";
|
||||
|
||||
} else {
|
||||
|
||||
print "<td><input disabled=\"true\" type=\"checkbox\"></td>";
|
||||
|
@ -967,6 +986,7 @@
|
|||
print "<td><input id=\"iedit_title\" value=\"$edit_title\"></td>";
|
||||
print "<td><input id=\"iedit_link\" value=\"$edit_link\"></td>";
|
||||
print "<td><input id=\"iedit_updintl\" value=\"".$line["update_interval"]."\"></td>";
|
||||
print "<td><input id=\"iedit_purgintl\" value=\"".$line["purge_interval"]."\"></td>";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,18 +4,43 @@
|
|||
define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
|
||||
|
||||
function purge_old_posts($link) {
|
||||
|
||||
$result = db_query($link, "SELECT id,purge_interval FROM ttrss_feeds");
|
||||
|
||||
while ($line = db_fetch_assoc($result)) {
|
||||
|
||||
$feed_id = $line["id"];
|
||||
$purge_interval = $line["purge_interval"];
|
||||
|
||||
if ($purge_interval == 0) $purge_interval = PURGE_OLD_DAYS;
|
||||
|
||||
if ($purge_interval != 0) {
|
||||
|
||||
if (DB_TYPE == "pgsql") {
|
||||
db_query($link, "DELETE FROM ttrss_entries WHERE
|
||||
marked = false AND feed_id = '$feed_id' AND
|
||||
date_entered < NOW() - INTERVAL '$purge_interval days'");
|
||||
} else {
|
||||
db_query($link, "DELETE FROM ttrss_entries WHERE
|
||||
marked = false AND AND feed_id = '$feed_id' AND
|
||||
date_entered < DATE_SUB(NOW(), INTERVAL $purge_interval DAY)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (PURGE_OLD_DAYS > 0) {
|
||||
|
||||
if (DB_TYPE == "pgsql") {
|
||||
$result = db_query($link, "DELETE FROM ttrss_entries WHERE
|
||||
marked = false AND
|
||||
marked = false AND feed_id = '$feed_id' AND
|
||||
date_entered < NOW() - INTERVAL '".PURGE_OLD_DAYS." days'");
|
||||
} else {
|
||||
$result = db_query($link, "DELETE FROM ttrss_entries WHERE
|
||||
marked = false AND
|
||||
marked = false AND AND feed_id = '$feed_id' AND
|
||||
date_entered < DATE_SUB(NOW(), INTERVAL ".PURGE_OLD_DAYS." DAY)");
|
||||
}
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
function update_all_feeds($link, $fetch) {
|
||||
|
|
7
prefs.js
7
prefs.js
|
@ -462,6 +462,7 @@ function feedEditSave() {
|
|||
var link = document.getElementById("iedit_link").value;
|
||||
var title = document.getElementById("iedit_title").value;
|
||||
var upd_intl = document.getElementById("iedit_updintl").value;
|
||||
var purge_intl = document.getElementById("iedit_purgintl").value;
|
||||
|
||||
// notify("Saving feed.");
|
||||
|
||||
|
@ -470,6 +471,10 @@ function feedEditSave() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (purge_intl < 0) {
|
||||
notify("Purge days must be >= 0 (0 = default)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (link.length == 0) {
|
||||
notify("Feed link cannot be blank.");
|
||||
|
@ -485,7 +490,7 @@ function feedEditSave() {
|
|||
|
||||
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editSave&id=" +
|
||||
feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) +
|
||||
"&ui=" + param_escape(upd_intl), true);
|
||||
"&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl), true);
|
||||
xmlhttp.onreadystatechange=feedlist_callback;
|
||||
xmlhttp.send(null);
|
||||
|
||||
|
|
|
@ -240,7 +240,8 @@ a:hover {
|
|||
opacity : 0.8;
|
||||
}
|
||||
|
||||
#iedit_title, #iedit_link, #iedit_regexp, #iedit_descr, #iedit_expr, #iedit_updintl {
|
||||
#iedit_title, #iedit_link, #iedit_regexp, #iedit_descr, #iedit_expr, #iedit_updintl,
|
||||
#iedit_purgintl {
|
||||
width : 100%;
|
||||
padding-left : 2px;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue