summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-01-17 13:19:18 +0100
committerAndrew Dolgov <[email protected]>2009-01-17 13:19:18 +0100
commit6c2a9b9ef76ac7bd592f747dc190025a6fdef0ea (patch)
treee2082756825abe3ec3aa9161767707c983f19e59 /functions.php
parentf115fb2c3ab4788558b7b020fa85eba1cb1aae12 (diff)
properly calculate ccache changes to child feeds when processing category
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/functions.php b/functions.php
index 8c11ed0d9..9072b981b 100644
--- a/functions.php
+++ b/functions.php
@@ -5975,7 +5975,8 @@
}
- function ccache_update($link, $feed_id, $owner_uid, $is_cat = false) {
+ function ccache_update($link, $feed_id, $owner_uid, $is_cat = false,
+ $direct_only = false) {
if (!$is_cat) {
$table = "ttrss_counters_cache";
@@ -6017,7 +6018,7 @@
}
- if ($feed_id > 0) {
+ if ($feed_id > 0 && !$direct_only) {
if (!$is_cat) {
@@ -6034,6 +6035,27 @@
while ($line = db_fetch_assoc($result)) {
ccache_update($link, $line["feed_id"], $owner_uid);
}
+ } else {
+
+ if ($feed_id == 0) {
+ $cat_qpart = "cat_id IS NULL";
+ } else {
+ $cat_qpart = "cat_id = '$feed_id'";
+ }
+
+ /* Update counters for our child feeds */
+
+ $result = db_query($link, "SELECT id FROM ttrss_feeds
+ WHERE owner_uid = '$owner_uid' AND $cat_qpart");
+
+ while ($line = db_fetch_assoc($result)) {
+ ccache_update($link, $line["id"], $owner_uid, false, true);
+ }
+
+ /* With that done, update our own counter again */
+
+ ccache_update($link, $feed_id, $owner_uid, true, true);
+
}
}