We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit efb7d28d authored by Shashi Gowda's avatar Shashi Gowda

Fix problems in joinAdd with xampp

Xampp ships with a different version of DB_DataObject PEAR package that
cannot do joins using objects correctly. This patch fixes the problem
parent 7b053ccf
...@@ -185,10 +185,12 @@ class Profile_list extends Memcached_DataObject ...@@ -185,10 +185,12 @@ class Profile_list extends Memcached_DataObject
function getSubscribers($offset=0, $limit=null, $since=0, $upto=0) function getSubscribers($offset=0, $limit=null, $since=0, $upto=0)
{ {
$subs = new Profile(); $subs = new Profile();
$sub = new Profile_tag_subscription();
$sub->profile_tag_id = $this->id;
$subs->joinAdd($sub); $subs->joinAdd(
array('id', 'profile_tag_subscription:profile_id')
);
$subs->whereAdd('profile_tag_subscription.profile_tag_id = ' . $this->id);
$subs->selectAdd('unix_timestamp(profile_tag_subscription.' . $subs->selectAdd('unix_timestamp(profile_tag_subscription.' .
'created) as "cursor"'); 'created) as "cursor"');
......
...@@ -55,20 +55,17 @@ class Profile_tag extends Memcached_DataObject ...@@ -55,20 +55,17 @@ class Profile_tag extends Memcached_DataObject
return $tags; return $tags;
} }
$profile_tag = new Profile_tag(); $qry = 'select profile_list.* from profile_list left join '.
$profile_list->tagger = $tagger; 'profile_tag on (profile_list.tag = profile_tag.tag and '.
$profile_tag->tagged = $tagged; 'profile_list.tagger = profile_tag.tagger) where '.
'profile_tag.tagger = %d and profile_tag.tagged = %d ';
$profile_list->selectAdd(); $qry = sprintf($qry, $tagger, $tagged);
// only fetch id, tag, mainpage and if (!$include_priv) {
// private hoping this will be faster $qry .= 'profile_list.private = 0';
$profile_list->selectAdd('profile_list.id, ' . }
'profile_list.tag, ' .
'profile_list.mainpage, ' . $profile_list->query($qry);
'profile_list.private');
$profile_list->joinAdd($profile_tag);
$profile_list->find();
Profile_list::setCache($key, $profile_list); Profile_list::setCache($key, $profile_list);
......
...@@ -99,7 +99,9 @@ class RawPeopletagNoticeStream extends NoticeStream ...@@ -99,7 +99,9 @@ class RawPeopletagNoticeStream extends NoticeStream
$ptag = new Profile_tag(); $ptag = new Profile_tag();
$ptag->tag = $this->profile_list->tag; $ptag->tag = $this->profile_list->tag;
$ptag->tagger = $this->profile_list->tagger; $ptag->tagger = $this->profile_list->tagger;
$notice->joinAdd($ptag); $notice->joinAdd(array('profile_id', 'profile_tag:tagged'));
$notice->whereAdd('profile_tag.tagger = ' . $this->profile_list->tagger);
$notice->whereAdd(sprintf('profile_tag.tag = "%s"', $this->profile_list->tag));
if ($since_id != 0) { if ($since_id != 0) {
$notice->whereAdd('notice.id > ' . $since_id); $notice->whereAdd('notice.id > ' . $since_id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment