]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile_tag.php
Merge commit 'refs/merge-requests/158' of git://gitorious.org/statusnet/mainline...
[quix0rs-gnu-social.git] / classes / Profile_tag.php
index d9b094182f1dcb7e11b343d0a2f232e00e4fc8d6..f1a60fdaa677f50084d1b6610508cf45710376ef 100644 (file)
@@ -79,20 +79,17 @@ class Profile_tag extends Managed_DataObject
             return $tags;
         }
 
-        $profile_tag = new Profile_tag();
-        $profile_list->tagger = $tagger;
-        $profile_tag->tagged = $tagged;
-
-        $profile_list->selectAdd();
-
-        // only fetch id, tag, mainpage and
-        // private hoping this will be faster
-        $profile_list->selectAdd('profile_list.id, ' .
-                                 'profile_list.tag, ' .
-                                 'profile_list.mainpage, ' .
-                                 'profile_list.private');
-        $profile_list->joinAdd($profile_tag);
-        $profile_list->find();
+        $qry = 'select profile_list.* from profile_list left join '.
+               'profile_tag on (profile_list.tag = profile_tag.tag and '.
+               'profile_list.tagger = profile_tag.tagger) where '.
+               'profile_tag.tagger = %d and profile_tag.tagged = %d ';
+        $qry = sprintf($qry, $tagger, $tagged);
+
+        if (!$include_priv) {
+            $qry .= 'profile_list.private = 0';
+        }
+
+        $profile_list->query($qry);
 
         Profile_list::setCache($key, $profile_list);