forked from GNUsocial/gnu-social
Merge commit 'br3nda/0.8.x-pgfixes' into 0.8.x
This commit is contained in:
commit
1139f7cad5
@ -79,7 +79,7 @@ class Fave extends Memcached_DataObject
|
|||||||
$qry .= 'ORDER BY modified DESC ';
|
$qry .= 'ORDER BY modified DESC ';
|
||||||
|
|
||||||
if (!is_null($offset)) {
|
if (!is_null($offset)) {
|
||||||
$qry .= "LIMIT $offset, $limit";
|
$qry .= "LIMIT $limit OFFSET $offset";
|
||||||
}
|
}
|
||||||
|
|
||||||
$fav->query($qry);
|
$fav->query($qry);
|
||||||
|
@ -873,7 +873,7 @@ class Notice extends Memcached_DataObject
|
|||||||
if ($cnt > 0) {
|
if ($cnt > 0) {
|
||||||
$qry .= ', ';
|
$qry .= ', ';
|
||||||
}
|
}
|
||||||
$qry .= '('.$id.', '.$this->id.', '.$source.', "'.$this->created.'") ';
|
$qry .= '('.$id.', '.$this->id.', '.$source.", '".$this->created. "') ";
|
||||||
$cnt++;
|
$cnt++;
|
||||||
if (rand() % NOTICE_INBOX_SOFT_LIMIT == 0) {
|
if (rand() % NOTICE_INBOX_SOFT_LIMIT == 0) {
|
||||||
Notice_inbox::gc($id);
|
Notice_inbox::gc($id);
|
||||||
@ -899,10 +899,14 @@ class Notice extends Memcached_DataObject
|
|||||||
{
|
{
|
||||||
$user = new User();
|
$user = new User();
|
||||||
|
|
||||||
|
if(common_config('db','quote_identifiers'))
|
||||||
|
$user_table = '"user"';
|
||||||
|
else $user_table = 'user';
|
||||||
|
|
||||||
$qry =
|
$qry =
|
||||||
'SELECT id ' .
|
'SELECT id ' .
|
||||||
'FROM user JOIN subscription '.
|
'FROM '. $user_table .' JOIN subscription '.
|
||||||
'ON user.id = subscription.subscriber ' .
|
'ON '. $user_table .'.id = subscription.subscriber ' .
|
||||||
'WHERE subscription.subscribed = %d ';
|
'WHERE subscription.subscribed = %d ';
|
||||||
|
|
||||||
$user->query(sprintf($qry, $this->profile_id));
|
$user->query(sprintf($qry, $this->profile_id));
|
||||||
|
@ -275,11 +275,14 @@ class User_group extends Memcached_DataObject
|
|||||||
// XXX: cache this
|
// XXX: cache this
|
||||||
|
|
||||||
$user = new User();
|
$user = new User();
|
||||||
|
if(common_config('db','quote_identifiers'))
|
||||||
|
$user_table = '"user"';
|
||||||
|
else $user_table = 'user';
|
||||||
|
|
||||||
$qry =
|
$qry =
|
||||||
'SELECT id ' .
|
'SELECT id ' .
|
||||||
'FROM user JOIN group_member '.
|
'FROM '. $user_table .' JOIN group_member '.
|
||||||
'ON user.id = group_member.profile_id ' .
|
'ON '. $user_table .'.id = group_member.profile_id ' .
|
||||||
'WHERE group_member.group_id = %d ';
|
'WHERE group_member.group_id = %d ';
|
||||||
|
|
||||||
$user->query(sprintf($qry, $this->id));
|
$user->query(sprintf($qry, $this->id));
|
||||||
|
@ -48,7 +48,7 @@ class GroupsByMembersSection extends GroupSection
|
|||||||
$qry = 'SELECT user_group.*, count(*) as value ' .
|
$qry = 'SELECT user_group.*, count(*) as value ' .
|
||||||
'FROM user_group JOIN group_member '.
|
'FROM user_group JOIN group_member '.
|
||||||
'ON user_group.id = group_member.group_id ' .
|
'ON user_group.id = group_member.group_id ' .
|
||||||
'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' .
|
'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified,user_group.design_id ' .
|
||||||
'ORDER BY value DESC ';
|
'ORDER BY value DESC ';
|
||||||
|
|
||||||
$limit = GROUPS_PER_SECTION;
|
$limit = GROUPS_PER_SECTION;
|
||||||
|
@ -48,7 +48,7 @@ class GroupsByPostsSection extends GroupSection
|
|||||||
$qry = 'SELECT user_group.*, count(*) as value ' .
|
$qry = 'SELECT user_group.*, count(*) as value ' .
|
||||||
'FROM user_group JOIN group_inbox '.
|
'FROM user_group JOIN group_inbox '.
|
||||||
'ON user_group.id = group_inbox.group_id ' .
|
'ON user_group.id = group_inbox.group_id ' .
|
||||||
'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' .
|
'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified,user_group.design_id ' .
|
||||||
'ORDER BY value DESC ';
|
'ORDER BY value DESC ';
|
||||||
|
|
||||||
$limit = GROUPS_PER_SECTION;
|
$limit = GROUPS_PER_SECTION;
|
||||||
|
@ -73,7 +73,7 @@ class GroupTagCloudSection extends TagCloudSection
|
|||||||
$quoted = array();
|
$quoted = array();
|
||||||
|
|
||||||
foreach ($names as $name) {
|
foreach ($names as $name) {
|
||||||
$quoted[] = "\"$name\"";
|
$quoted[] = "'$name'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$namestring = implode(',', $quoted);
|
$namestring = implode(',', $quoted);
|
||||||
|
@ -74,11 +74,7 @@ class PopularNoticeSection extends NoticeSection
|
|||||||
$offset = 0;
|
$offset = 0;
|
||||||
$limit = NOTICES_PER_SECTION + 1;
|
$limit = NOTICES_PER_SECTION + 1;
|
||||||
|
|
||||||
if (common_config('db', 'type') == 'pgsql') {
|
$qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
|
||||||
$qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
|
|
||||||
} else {
|
|
||||||
$qry .= ' LIMIT ' . $offset . ', ' . $limit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$notice = Memcached_DataObject::cachedQuery('Notice',
|
$notice = Memcached_DataObject::cachedQuery('Notice',
|
||||||
sprintf($qry, common_config('popular', 'dropoff')),
|
sprintf($qry, common_config('popular', 'dropoff')),
|
||||||
|
Loading…
Reference in New Issue
Block a user