From: Evan Prodromou <evan@status.net>
Date: Mon, 4 Jul 2011 16:39:57 +0000 (-0400)
Subject: TagSub doesn't refetch empty set of tag subscriptions
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d4b7f5d8acb0ebe9eb53a180a54285422beb4b19;p=quix0rs-gnu-social.git

TagSub doesn't refetch empty set of tag subscriptions
---

diff --git a/plugins/TagSub/TagSub.php b/plugins/TagSub/TagSub.php
index a03be48ac3..c0c4c1ec86 100644
--- a/plugins/TagSub/TagSub.php
+++ b/plugins/TagSub/TagSub.php
@@ -146,18 +146,18 @@ class TagSub extends Managed_DataObject
         $keypart = sprintf('tagsub:by_profile:%d', $profile->id);
         $tagstring = self::cacheGet($keypart);
         
-        if ($tagstring !== false && !empty($tagstring)) {
-            $tags = explode(',', $tagstring);
+        if ($tagstring !== false) { // cache hit
+        	if (!empty($tagstring)) {
+            	$tags = explode(',', $tagstring);
+        	}
         } else {
-            $tagsub = new TagSub();
+            $tagsub             = new TagSub();
             $tagsub->profile_id = $profile->id;
+            $tagsub->selectAdd();
+            $tagsub->selectAdd('tag');
 
             if ($tagsub->find()) {
-                while ($tagsub->fetch()) {
-                    if (!empty($tagsub->tag)) {
-                        $tags[] = $tagsub->tag;
-                    }
-                }
+				$tags = $tagsub->fetchAll('tag');
             }
 
             self::cacheSet($keypart, implode(',', $tags));