]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/TagSub/TagSub.php
Make optional arguments for getNoticeIds explicit
[quix0rs-gnu-social.git] / plugins / TagSub / TagSub.php
index 9662811bf9ffa30b6770a4c164b03daaddc3f233..c0c4c1ec86f4c2233f31fbf743563019a0d21605 100644 (file)
@@ -42,7 +42,6 @@ if (!defined('STATUSNET')) {
  *
  * @see      DB_DataObject
  */
-
 class TagSub extends Managed_DataObject
 {
     public $__table = 'tagsub'; // table name
@@ -147,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));