X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FPost%2FContent.php;h=0694b3a377b7fb8cb262c43a093f15ddfed2e23c;hb=21f172c585aff8c606774a05fde1548ddff1667d;hp=cdca7e8ca3aab1d7bddf39f95e1f99383a334c0d;hpb=998f127cb83a12c3e4b626f2381a867988c8f5d2;p=friendica.git diff --git a/src/Model/Post/Content.php b/src/Model/Post/Content.php index cdca7e8ca3..0694b3a377 100644 --- a/src/Model/Post/Content.php +++ b/src/Model/Post/Content.php @@ -1,6 +1,6 @@ truncateFieldsForTable('post-content', $data); // Additionally assign the key fields $fields['uri-id'] = $uri_id; @@ -67,7 +68,7 @@ class Content throw new BadMethodCallException('Empty URI_id'); } - $fields = DBStructure::getFieldsForTable('post-content', $data); + $fields = DI::dbaDefinition()->truncateFieldsForTable('post-content', $data); // Remove the key fields unset($fields['uri-id']); @@ -109,8 +110,8 @@ class Content public static function getURIIdListBySearch(string $search, int $uid = 0, int $start = 0, int $limit = 100, int $last_uriid = 0) { $condition = ["`uri-id` IN (SELECT `uri-id` FROM `post-content` WHERE MATCH (`title`, `content-warning`, `body`) AGAINST (? IN BOOLEAN MODE)) - AND (NOT `private` OR (`private` AND `uid` = ?)) AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))", - $search, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0]; + AND (`uid` = ? OR (`uid` = ? AND NOT `global`)) AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))", + str_replace('@', ' ', $search), 0, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0]; if (!empty($last_uriid)) { $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $last_uriid]); @@ -118,7 +119,6 @@ class Content $params = [ 'order' => ['uri-id' => true], - 'group_by' => ['uri-id'], 'limit' => [$start, $limit] ]; @@ -136,8 +136,8 @@ class Content public static function countBySearch(string $search, int $uid = 0) { $condition = ["`uri-id` IN (SELECT `uri-id` FROM `post-content` WHERE MATCH (`title`, `content-warning`, `body`) AGAINST (? IN BOOLEAN MODE)) - AND (NOT `private` OR (`private` AND `uid` = ?)) AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))", - $search, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0]; + AND (`uid` = ? OR (`uid` = ? AND NOT `global`)) AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))", + str_replace('@', ' ', $search), 0, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0]; return Post::count($condition); } }