]> git.wh0rd.org - tt-rss.git/commitdiff
update ccache in catchupArticleById(); misc counter-related tweaks; add getArticleFeed()
authorAndrew Dolgov <fox@bah.org.ru>
Tue, 29 Dec 2009 13:10:40 +0000 (16:10 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Tue, 29 Dec 2009 13:10:40 +0000 (16:10 +0300)
backend.php
functions.php

index cee8c26ceb0b283276617633a46824083746a5b2..b83c4ff2a78c4eedaa4c8f514434314657557fee 100644 (file)
                        // in prefetch mode we only output requested cids, main article 
                        // just gets marked as read (it already exists in client cache)
 
+                       $feed_id = false;
+
                        if ($mode == "") {
                                outputArticleXML($link, $id, false);
                        } else if ($mode == "zoom") {
                                outputArticleXML($link, $id, false, true, true);
                        } else {
                                catchupArticleById($link, $id, 0);
-                               ccache_update($link, $feed_id, $_SESSION["uid"]);
                        }
 
                        if (!$_SESSION["bw_limit"]) {
 
 //                     if (get_pref($link, "SYNC_COUNTERS") || ($mode == "prefetch" && $csync)) {
 
-                       if (time() - $_SESSION["view:counters_stamp"] > 3 && $mode == "prefetch") {
+                       if (time() - $_SESSION["view:counters_stamp"] > 5 && $mode == "prefetch") {
                                print "<counters>";
                                getAllCounters($link, $omode);
                                print "</counters>";
 //                     }
 
                        if (get_pref($link, 'COMBINED_DISPLAY_MODE') || $subop || 
-                               time() - $_SESSION["viewfeed:counters_stamp"] > 60) {
+                               time() - $_SESSION["viewfeed:counters_stamp"] > 5) {
                                if (!$offset) {
                                        print "<counters>";
                                        getAllCounters($link, $omode, $feed);
index 5fefe6bee11ad919b6ff22c7587db606ee3d478d..464a2cbdd3f9c0e240aa9d12671ab59de77f1cec 100644 (file)
                        unread = NOT unread,last_read = NOW()
                        WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
                }
+
+               $feed_id = getArticleFeed($link, $id);
+               ccache_update($link, $feed_id, $_SESSION["uid"]);
        }
 
        function make_guid_from_title($title) {
 
                db_query($link, "COMMIT");
        }
+
+       function getArticleFeed($link, $id) {
+               $result = db_query($link, "SELECT feed_id FROM ttrss_user_entries 
+                       WHERE ref_id = '$id'");
+
+               if (db_num_rows($result) != 0) {
+                       return db_fetch_result($result, 0, "feed_id");
+               } else {
+                       return 0;
+               }
+       }
 ?>