]> git.wh0rd.org Git - tt-rss.git/commitdiff
add experimental hack to speed up ccache category calculation
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 9 Oct 2013 12:58:31 +0000 (16:58 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 9 Oct 2013 12:58:31 +0000 (16:58 +0400)
include/ccache.php

index d89b9efe03c8b61a477c5e28b5ddbd9006ddd6f5..406dec81d1b1da8e0e88feadaff697270f884bc6 100644 (file)
@@ -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;
 
 
                        /* 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
 
                                        $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);
 
                                }
                        }