mirror of
https://github.com/friendica/friendica
synced 2025-04-26 19:50:10 +00:00
(Hopefully) SQL improvements
This commit is contained in:
parent
be9bbe1709
commit
3911c9450b
11 changed files with 34 additions and 35 deletions
|
@ -79,13 +79,13 @@ class Notifications extends BaseApi
|
|||
|
||||
if (in_array(Notification::TYPE_INTRODUCTION, $request['exclude_types'])) {
|
||||
$condition = DBA::mergeConditions($condition,
|
||||
["(`vid` != ? OR `type` != ? OR NOT EXISTS (SELECT `id` FROM `contact` WHERE `id` = `actor-id` AND `pending`))",
|
||||
["(`vid` != ? OR `type` != ? OR NOT `actor-id` IN (SELECT `id` FROM `contact` WHERE `pending`))",
|
||||
Verb::getID(Activity::FOLLOW), Post\UserNotification::TYPE_NONE]);
|
||||
}
|
||||
|
||||
if (in_array(Notification::TYPE_FOLLOW, $request['exclude_types'])) {
|
||||
$condition = DBA::mergeConditions($condition,
|
||||
["(`vid` != ? OR `type` != ? OR NOT EXISTS (SELECT `id` FROM `contact` WHERE `id` = `actor-id` AND NOT `pending`))",
|
||||
["(`vid` != ? OR `type` != ? OR NOT `actor-id` IN (SELECT `id` FROM `contact` WHERE NOT `pending`))",
|
||||
Verb::getID(Activity::FOLLOW), Post\UserNotification::TYPE_NONE]);
|
||||
}
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ class Search extends BaseApi
|
|||
|
||||
$params = ['order' => ['name'], 'limit' => [$offset, $limit]];
|
||||
|
||||
$condition = ["EXISTS(SELECT `tid` FROM `post-tag` WHERE `type` = ? AND `tid` = `id`) AND `name` LIKE ?", Tag::HASHTAG, $q . '%'];
|
||||
$condition = ["`id` IN (SELECT `tid` FROM `post-tag` WHERE `type` = ?) AND `name` LIKE ?", Tag::HASHTAG, $q . '%'];
|
||||
|
||||
$tags = DBA::select('tag', ['name'], $condition, $params);
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ class PublicTimeline extends BaseApi
|
|||
|
||||
if (!empty($uid)) {
|
||||
$condition = DBA::mergeConditions($condition,
|
||||
["NOT EXISTS (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `parent-author-id` AND (`blocked` OR `ignored`))", $uid]);
|
||||
["NOT `parent-author-id` IN (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND (`blocked` OR `ignored`))", $uid]);
|
||||
}
|
||||
|
||||
$items = Post::selectPostsForUser($uid, ['uri-id'], $condition, $params);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue