catchup_feed: properly mark subcategories as read

This commit is contained in:
Andrew Dolgov 2012-10-17 20:00:36 +04:00
parent ce5652160e
commit bda6afa22b

View file

@ -1233,24 +1233,22 @@
if ($feed >= 0) { if ($feed >= 0) {
if ($feed > 0) { if ($feed > 0) {
$cat_qpart = "cat_id = '$feed'"; $children = getChildCategories($link, $feed, $owner_uid);
array_push($children, $feed);
$children = join(",", $children);
$cat_qpart = "cat_id IN ($children)";
} else { } else {
$cat_qpart = "cat_id IS NULL"; $cat_qpart = "cat_id IS NULL";
} }
$tmp_result = db_query($link, "SELECT id db_query($link, "UPDATE ttrss_user_entries
FROM ttrss_feeds WHERE $cat_qpart AND owner_uid = $owner_uid"); SET unread = false,last_read = NOW()
WHERE feed_id IN (SELECT id FROM ttrss_feeds WHERE $cat_qpart)
AND $ref_check_qpart
AND owner_uid = $owner_uid");
while ($tmp_line = db_fetch_assoc($tmp_result)) {
$tmp_feed = $tmp_line["id"];
db_query($link, "UPDATE ttrss_user_entries
SET unread = false,last_read = NOW()
WHERE feed_id = '$tmp_feed'
AND $ref_check_qpart
AND owner_uid = $owner_uid");
}
} else if ($feed == -2) { } else if ($feed == -2) {
db_query($link, "UPDATE ttrss_user_entries db_query($link, "UPDATE ttrss_user_entries