update ccache in catchupArticleById(); misc counter-related tweaks; add getArticleFeed()

This commit is contained in:
Andrew Dolgov 2009-12-29 16:10:40 +03:00
parent a12eb9c327
commit ab197ae1de
2 changed files with 18 additions and 3 deletions

View File

@ -222,13 +222,14 @@
// in prefetch mode we only output requested cids, main article // in prefetch mode we only output requested cids, main article
// just gets marked as read (it already exists in client cache) // just gets marked as read (it already exists in client cache)
$feed_id = false;
if ($mode == "") { if ($mode == "") {
outputArticleXML($link, $id, false); outputArticleXML($link, $id, false);
} else if ($mode == "zoom") { } else if ($mode == "zoom") {
outputArticleXML($link, $id, false, true, true); outputArticleXML($link, $id, false, true, true);
} else { } else {
catchupArticleById($link, $id, 0); catchupArticleById($link, $id, 0);
ccache_update($link, $feed_id, $_SESSION["uid"]);
} }
if (!$_SESSION["bw_limit"]) { if (!$_SESSION["bw_limit"]) {
@ -241,7 +242,7 @@
// if (get_pref($link, "SYNC_COUNTERS") || ($mode == "prefetch" && $csync)) { // 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>"; print "<counters>";
getAllCounters($link, $omode); getAllCounters($link, $omode);
print "</counters>"; print "</counters>";
@ -365,7 +366,7 @@
// } // }
if (get_pref($link, 'COMBINED_DISPLAY_MODE') || $subop || if (get_pref($link, 'COMBINED_DISPLAY_MODE') || $subop ||
time() - $_SESSION["viewfeed:counters_stamp"] > 60) { time() - $_SESSION["viewfeed:counters_stamp"] > 5) {
if (!$offset) { if (!$offset) {
print "<counters>"; print "<counters>";
getAllCounters($link, $omode, $feed); getAllCounters($link, $omode, $feed);

View File

@ -4044,6 +4044,9 @@
unread = NOT unread,last_read = NOW() unread = NOT unread,last_read = NOW()
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]); 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) { function make_guid_from_title($title) {
@ -6469,4 +6472,15 @@
db_query($link, "COMMIT"); 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;
}
}
?> ?>