summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-11-11 12:34:12 +0400
committerAndrew Dolgov <[email protected]>2011-11-11 12:34:12 +0400
commitca5133cb91c8fe450eaf6ce03a8472823a2a6e07 (patch)
tree7ae8d99a251952076389005c837cfa0e8307e0b9 /functions.php
parent9c506873582e0c90d953b5ec81cc0f6d55681523 (diff)
further reduce db hit on tags in viewfeed
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/functions.php b/functions.php
index 4f1b81f2d..fd89f5099 100644
--- a/functions.php
+++ b/functions.php
@@ -4590,7 +4590,7 @@
return $feedlist;
}
- function get_article_tags($link, $id, $owner_uid = 0) {
+ function get_article_tags($link, $id, $owner_uid = 0, $tag_cache = false) {
global $memcache;
@@ -4611,10 +4611,12 @@
} else {
/* check cache first */
- $result = db_query($link, "SELECT tag_cache FROM ttrss_user_entries
- WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
+ if ($tag_cache === false) {
+ $result = db_query($link, "SELECT tag_cache FROM ttrss_user_entries
+ WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
- $tag_cache = db_fetch_result($result, 0, "tag_cache");
+ $tag_cache = db_fetch_result($result, 0, "tag_cache");
+ }
if ($tag_cache) {
$tags = explode(",", $tag_cache);
@@ -5537,10 +5539,9 @@
$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);
+ $tags_str = format_tags_string(
+ get_article_tags($link, $id, $_SESSION["uid"], $tag_cache),
+ $id);
$reply['content'] .= "<img src='".theme_image($link,
'images/tag.png')."' alt='Tags' title='Tags'>