]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
rewrite Profile_tag::getTagsArray() so it doesn't use joinAdd()
authorEvan Prodromou <evan@status.net>
Tue, 27 Sep 2011 13:42:34 +0000 (09:42 -0400)
committerEvan Prodromou <evan@status.net>
Tue, 27 Sep 2011 13:42:34 +0000 (09:42 -0400)
classes/Profile_tag.php

index f1a60fdaa677f50084d1b6610508cf45710376ef..c9f8d96713e29713cb43c03293f7ec6ea50893a0 100644 (file)
@@ -99,23 +99,26 @@ class Profile_tag extends Managed_DataObject
     static function getTagsArray($tagger, $tagged, $auth_user_id=null)
     {
         $ptag = new Profile_tag();
-        $ptag->tagger = $tagger;
-        $ptag->tagged = $tagged;
-
-        if ($tagger != $auth_user_id) {
-            $list = new Profile_list();
-            $list->private = false;
-            $ptag->joinAdd($list);
-            $ptag->selectAdd();
-            $ptag->selectAdd('profile_tag.tag');
+
+        $qry = sprint('select profile_tag.tag '.
+                      'from profile_tag join profile_list '.
+                      ' on (profile_tag.tagger = profile_list.tagger ' .
+                      '     and profile_tag.tag = profile_list.tag) ' .
+                      'where profile_tag.tagger = %d ' .
+                      'and   profile_tag.tagged = %d ',
+                      $tagger, $tagged);
+
+        if ($auth_user_id != $tagger) {
+            $qry .= 'and profile_list.private = 0';
         }
 
         $tags = array();
-        $ptag->find();
+
+        $ptag->query($sql);
+
         while ($ptag->fetch()) {
             $tags[] = $ptag->tag;
         }
-        $ptag->free();
 
         return $tags;
     }