From 1bad74ea7cfb9c8f2c97460187cabe7400b626c0 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 26 Feb 2013 22:49:46 +0400 Subject: [PATCH] change various catchup stuff to only affect unread articles --- classes/feeds.php | 2 +- include/functions.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/classes/feeds.php b/classes/feeds.php index fed960565..a2e19d580 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -745,7 +745,7 @@ class Feeds extends Handler_Protected { function catchupAll() { db_query($this->link, "UPDATE ttrss_user_entries SET - last_read = NOW(),unread = false WHERE owner_uid = " . $_SESSION["uid"]); + last_read = NOW(), unread = false WHERE unread = true AND owner_uid = " . $_SESSION["uid"]); ccache_zero_all($this->link, $_SESSION["uid"]); } diff --git a/include/functions.php b/include/functions.php index 4d3051a0c..00193c995 100644 --- a/include/functions.php +++ b/include/functions.php @@ -990,7 +990,7 @@ db_query($link, "UPDATE ttrss_user_entries SET unread = false,last_read = NOW() WHERE feed_id IN (SELECT id FROM ttrss_feeds WHERE $cat_qpart) - AND $ref_check_qpart + AND $ref_check_qpart AND unread = true AND owner_uid = $owner_uid"); } else if ($feed == -2) { @@ -1007,7 +1007,7 @@ db_query($link, "UPDATE ttrss_user_entries SET unread = false,last_read = NOW() WHERE feed_id = '$feed' - AND $ref_check_qpart + AND $ref_check_qpart AND unread = true AND owner_uid = $owner_uid"); } else if ($feed < 0 && $feed > -10) { // special, like starred @@ -1016,7 +1016,7 @@ db_query($link, "UPDATE ttrss_user_entries SET unread = false,last_read = NOW() WHERE marked = true - AND $ref_check_qpart + AND $ref_check_qpart AND unread = true AND owner_uid = $owner_uid"); } @@ -1024,7 +1024,7 @@ db_query($link, "UPDATE ttrss_user_entries SET unread = false,last_read = NOW() WHERE published = true - AND $ref_check_qpart + AND $ref_check_qpart AND unread = true AND owner_uid = $owner_uid"); } @@ -1057,7 +1057,8 @@ if ($feed == -4) { db_query($link, "UPDATE ttrss_user_entries SET unread = false,last_read = NOW() - WHERE $ref_check_qpart AND owner_uid = $owner_uid"); + WHERE $ref_check_qpart AND unread = true AND + owner_uid = $owner_uid"); } } else if ($feed < -10) { // label @@ -1085,7 +1086,8 @@ while ($line = db_fetch_assoc($result)) { db_query($link, "UPDATE ttrss_user_entries SET unread = false, last_read = NOW() - WHERE $ref_check_qpart AND int_id = " . $line["post_int_id"]); + WHERE $ref_check_qpart AND unread = true + AND int_id = " . $line["post_int_id"]); } db_query($link, "COMMIT"); }