]> git.wh0rd.org Git - tt-rss.git/commitdiff
viewfeed, view: performance improvements
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 11 Nov 2011 08:27:10 +0000 (12:27 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 11 Nov 2011 08:27:10 +0000 (12:27 +0400)
functions.php

index 40e5837658f956dac551c586b29d58256c6a674a..4f1b81f2d1cac6a81bce4f8c2c9485ce8c1de12b 100644 (file)
                                                guid,
                                                ttrss_entries.id,ttrss_entries.title,
                                                updated,
+                                               label_cache,
+                                               tag_cache,
                                                note,
                                                unread,feed_id,marked,published,link,last_read,orig_feed_id,
                                                ".SUBSTRING_FOR_DATE."(last_read,1,19) as last_read_noms,
                        (SELECT icon_url FROM ttrss_feeds WHERE id = feed_id) as icon_url,
                        (SELECT site_url FROM ttrss_feeds WHERE id = feed_id) as site_url,
                        num_comments,
+                       tag_cache,
                        author,
                        orig_feed_id,
                        note
                                $rv['content'] .= "<div clear='both'>" . $line["title"] . "$entry_author</div>";
                        }
 
-                       $tags = get_article_tags($link, $id);
+                       $tag_cache = $line["tag_cache"];
+
+                       if (!$tag_cache)
+                               $tags = get_article_tags($link, $id);
+                       else
+                               $tags = explode(",", $tag_cache);
+
                        $tags_str = format_tags_string($tags, $id);
                        $tags_str_full = join(", ", $tags);
 
 
                                $id = $line["id"];
                                $feed_id = $line["feed_id"];
+                               $label_cache = $line["label_cache"];
+                               $labels = false;
+
+                               if ($label_cache) {
+                                       $label_cache = json_decode($label_cache, true);
 
-                               $labels = get_article_labels($link, $id);
+                                       if ($label_cache) {
+                                               if ($label_cache["no-labels"] == 1)
+                                                       $labels = array();
+                                               else
+                                                       $labels = $label_cache;
+                                       }
+                               }
+
+                               if (!is_array($labels)) $labels = get_article_labels($link, $id);
 
                                $labels_str = "<span id=\"HLLCTR-$id\">";
                                $labels_str .= format_article_labels($labels, $id);
 
                                        $reply['content'] .= "<div class=\"cdmFooter\">";
 
-                                       $tags_str = format_tags_string(get_article_tags($link, $id), $id);
+                                       $tag_cache = $line["tag_cache"];
+
+                                       if ($tag_cache)
+                                               $tags_str = format_tags_string(explode(",", $tag_cache), $id);
+                                       else
+                                               $tags_str = format_tags_string(get_article_tags($link, $id), $id);
 
                                        $reply['content'] .= "<img src='".theme_image($link,
                                                        'images/tag.png')."' alt='Tags' title='Tags'>