only download articles which are newer than the last stored in local db
This commit is contained in:
parent
1ea930cbea
commit
95f0c2c5b3
2 changed files with 11 additions and 1 deletions
|
@ -516,6 +516,7 @@
|
||||||
|
|
||||||
if ($subop == "download") {
|
if ($subop == "download") {
|
||||||
$stage = (int) $_REQUEST["stage"];
|
$stage = (int) $_REQUEST["stage"];
|
||||||
|
$cid = db_escape_string($_REQUEST["cid"]);
|
||||||
$amount = (int) $_REQUEST["amount"];
|
$amount = (int) $_REQUEST["amount"];
|
||||||
$unread_only = db_escape_string($_REQUEST["unread_only"]);
|
$unread_only = db_escape_string($_REQUEST["unread_only"]);
|
||||||
|
|
||||||
|
@ -561,11 +562,15 @@
|
||||||
$unread_qpart = "unread = true AND ";
|
$unread_qpart = "unread = true AND ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($cid) {
|
||||||
|
$cid_qpart = "id > $cid AND ";
|
||||||
|
}
|
||||||
|
|
||||||
$result = db_query($link,
|
$result = db_query($link,
|
||||||
"SELECT DISTINCT id,title,guid,link,
|
"SELECT DISTINCT id,title,guid,link,
|
||||||
feed_id,content,updated,unread,marked FROM
|
feed_id,content,updated,unread,marked FROM
|
||||||
ttrss_user_entries,ttrss_entries
|
ttrss_user_entries,ttrss_entries
|
||||||
WHERE $unread_qpart
|
WHERE $unread_qpart $cid_qpart
|
||||||
ref_id = id AND owner_uid = ".$_SESSION["uid"]."
|
ref_id = id AND owner_uid = ".$_SESSION["uid"]."
|
||||||
ORDER BY updated DESC LIMIT $limit OFFSET $skip");
|
ORDER BY updated DESC LIMIT $limit OFFSET $skip");
|
||||||
|
|
||||||
|
|
|
@ -1600,6 +1600,11 @@ function initiate_offline_download(stage) {
|
||||||
|
|
||||||
var query = "backend.php?op=rpc&subop=download&stage=" + stage;
|
var query = "backend.php?op=rpc&subop=download&stage=" + stage;
|
||||||
|
|
||||||
|
var rs = db.execute("SELECT MAX(id) FROM articles");
|
||||||
|
if (rs.isValidRow()) {
|
||||||
|
query = query + "&cid=" + rs.field(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (document.getElementById("download_ops_form")) {
|
if (document.getElementById("download_ops_form")) {
|
||||||
query = query + "&" + Form.serialize("download_ops_form");
|
query = query + "&" + Form.serialize("download_ops_form");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue