]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
TagSub doesn't refetch empty set of tag subscriptions
authorEvan Prodromou <evan@status.net>
Mon, 4 Jul 2011 16:39:57 +0000 (12:39 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 4 Jul 2011 16:39:57 +0000 (12:39 -0400)
plugins/TagSub/TagSub.php

index a03be48ac3778b48063e6f795cbc36a6c251259b..c0c4c1ec86f4c2233f31fbf743563019a0d21605 100644 (file)
@@ -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));