From 9c506873582e0c90d953b5ec81cc0f6d55681523 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 11 Nov 2011 12:27:10 +0400 Subject: [PATCH] viewfeed, view: performance improvements --- functions.php | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/functions.php b/functions.php index 40e58376..4f1b81f2 100644 --- a/functions.php +++ b/functions.php @@ -3696,6 +3696,8 @@ 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, @@ -4812,6 +4814,7 @@ (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 @@ -4885,7 +4888,13 @@ $rv['content'] .= "
" . $line["title"] . "$entry_author
"; } - $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); @@ -5152,8 +5161,21 @@ $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 = ""; $labels_str .= format_article_labels($labels, $id); @@ -5513,7 +5535,12 @@ $reply['content'] .= "
"; - $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'] .= "Tags -- 2.39.5