]> git.wh0rd.org Git - tt-rss.git/commitdiff
only download articles which are newer than the last stored in local db
authorAndrew Dolgov <fox@bah.org.ru>
Tue, 3 Feb 2009 15:21:39 +0000 (18:21 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Tue, 3 Feb 2009 15:21:39 +0000 (18:21 +0300)
modules/backend-rpc.php
tt-rss.js

index 64e7df2f0c26db36e41f5e32102f5842e4f194b6..4212c1b8ce3b1843555a611aa7ab607dc6a7fef5 100644 (file)
 
                if ($subop == "download") {
                        $stage = (int) $_REQUEST["stage"];
+                       $cid = db_escape_string($_REQUEST["cid"]);
                        $amount = (int) $_REQUEST["amount"];
                        $unread_only = db_escape_string($_REQUEST["unread_only"]);
 
                                                $unread_qpart = "unread = true AND ";
                                        }
 
+                                       if ($cid) {
+                                               $cid_qpart =  "id > $cid AND ";
+                                       }
+
                                        $result = db_query($link,
                                                "SELECT DISTINCT id,title,guid,link,
                                                                feed_id,content,updated,unread,marked FROM
                                                        ttrss_user_entries,ttrss_entries
-                                                       WHERE $unread_qpart
+                                                       WHERE $unread_qpart $cid_qpart
                                                        ref_id = id AND owner_uid = ".$_SESSION["uid"]."
                                                        ORDER BY updated DESC LIMIT $limit OFFSET $skip");
        
index 15227c325bfd7cf1aa4090da8b961b73b1e9b3d3..666476778c8723b45bf5ea194e1d9b205a9b2400 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -1600,6 +1600,11 @@ function initiate_offline_download(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")) {
                        query = query + "&" + Form.serialize("download_ops_form");
                }