summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-01-16 17:41:21 +0100
committerAndrew Dolgov <[email protected]>2009-01-16 17:41:21 +0100
commitd232a40f8b966aab1d4cfa57461b60844d535196 (patch)
treed10d422e48ba6c18ac3c003e3d94814f77905c9b /functions.php
parentde0a21223f00f15d13ef8c8dd561600fa990a052 (diff)
category counters: code cleanup
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php22
1 files changed, 11 insertions, 11 deletions
diff --git a/functions.php b/functions.php
index 97d34dd55..a3fc5d5c9 100644
--- a/functions.php
+++ b/functions.php
@@ -2334,25 +2334,25 @@
$age_qpart = getMaxAgeSubquery();
-/* $result = db_query($link, "SELECT cat_id,SUM((SELECT COUNT(int_id)
- FROM ttrss_user_entries, ttrss_entries WHERE feed_id = ttrss_feeds.id
- AND id = ref_id AND $age_qpart
- AND unread = true)) AS unread FROM ttrss_feeds
+ $result = db_query($link, "SELECT cat_id, value AS unread
+ FROM ttrss_feeds, ttrss_cat_counters_cache
WHERE
- hidden = false AND owner_uid = ".$_SESSION["uid"]." GROUP BY cat_id"); */
-
- $result = db_query($link, "SELECT cat_id FROM ttrss_feeds
- WHERE
- hidden = false AND owner_uid = ".$_SESSION["uid"]." GROUP BY cat_id");
+ ttrss_cat_counters_cache.feed_id = cat_id AND
+ hidden = false AND
+ ttrss_feeds.owner_uid = ".$_SESSION["uid"]." GROUP BY cat_id");
while ($line = db_fetch_assoc($result)) {
$line["cat_id"] = sprintf("%d", $line["cat_id"]);
- $line["unread"] = ccache_find($link, $line["cat_id"], $_SESSION["uid"], true);
-
print "<counter type=\"category\" id=\"".$line["cat_id"]."\" counter=\"".
$line["unread"]."\"/>";
}
+
+ /* Special case: NULL category doesn't actually exist in the DB */
+
+ print "<counter type=\"category\" id=\"0\" counter=\"".
+ ccache_find($link, 0, $_SESSION["uid"], true)."\"/>";
+
}
function getCategoryUnread($link, $cat) {