From b66be03a4865b50efeddfce00cc45b7b7c9692ef Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 9 Oct 2013 16:58:31 +0400 Subject: [PATCH] add experimental hack to speed up ccache category calculation --- include/ccache.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/ccache.php b/include/ccache.php index d89b9efe..406dec81 100644 --- a/include/ccache.php +++ b/include/ccache.php @@ -92,7 +92,7 @@ } function ccache_update($feed_id, $owner_uid, $is_cat = false, - $update_pcat = true) { + $update_pcat = true, $pcat_fast = false) { if (!is_numeric($feed_id)) return; @@ -127,11 +127,13 @@ /* Recalculate counters for child feeds */ - $result = db_query("SELECT id FROM ttrss_feeds + if (!$pcat_fast) { + $result = db_query("SELECT id FROM ttrss_feeds WHERE owner_uid = '$owner_uid' AND $cat_qpart"); - while ($line = db_fetch_assoc($result)) { - ccache_update($line["id"], $owner_uid, false, false); + while ($line = db_fetch_assoc($result)) { + ccache_update($line["id"], $owner_uid, false, false); + } } $result = db_query("SELECT SUM(value) AS sv @@ -177,7 +179,7 @@ $cat_id = (int) db_fetch_result($result, 0, "cat_id"); - ccache_update($cat_id, $owner_uid, true); + ccache_update($cat_id, $owner_uid, true, true, true); } } -- 2.39.5