mirror of
https://github.com/friendica/friendica
synced 2025-04-28 02:30:16 +00:00
Get rid of the "item" table, enhanced "post" tables
This commit is contained in:
parent
c918e83aa2
commit
ce6ad1aa73
23 changed files with 736 additions and 235 deletions
|
@ -868,8 +868,9 @@ class Processor
|
|||
}
|
||||
|
||||
$replyto = JsonLD::fetchElement($activity['as:object'], 'as:inReplyTo', '@id');
|
||||
if (Post::exists(['uri' => $replyto])) {
|
||||
Logger::info('Post is a reply to an existing post - accepted', ['id' => $id, 'replyto' => $replyto]);
|
||||
$uriid = ItemURI::getIdByURI($replyto);
|
||||
if (Post::exists(['uri-id' => $uriid])) {
|
||||
Logger::info('Post is a reply to an existing post - accepted', ['id' => $id, 'uri-id' => $uriid, 'replyto' => $replyto]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -930,7 +930,7 @@ class Receiver
|
|||
} else {
|
||||
Logger::log('Empty content for ' . $object_id . ', check if content is available locally.', Logger::DEBUG);
|
||||
|
||||
$item = Post::selectFirst([], ['uri' => $object_id]);
|
||||
$item = Post::selectFirst(Item::DELIVER_FIELDLIST, ['uri' => $object_id]);
|
||||
if (!DBA::isResult($item)) {
|
||||
Logger::log('Object with url ' . $object_id . ' was not found locally.', Logger::DEBUG);
|
||||
return false;
|
||||
|
|
|
@ -258,7 +258,7 @@ class Transmitter
|
|||
$condition = array_merge($condition,
|
||||
['author-id' => $public_contact,
|
||||
'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT],
|
||||
'deleted' => false, 'visible' => true, 'moderated' => false]);
|
||||
'deleted' => false, 'visible' => true]);
|
||||
|
||||
$count = Post::count($condition);
|
||||
|
||||
|
@ -1045,19 +1045,19 @@ class Transmitter
|
|||
public static function createActivityFromItem(int $item_id, bool $object_mode = false)
|
||||
{
|
||||
Logger::info('Fetching activity', ['item' => $item_id]);
|
||||
$item = Post::selectFirst([], ['id' => $item_id, 'parent-network' => Protocol::NATIVE_SUPPORT]);
|
||||
$item = Post::selectFirst(Item::DELIVER_FIELDLIST, ['id' => $item_id, 'parent-network' => Protocol::NATIVE_SUPPORT]);
|
||||
if (!DBA::isResult($item)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// In case of a forum post ensure to return the original post if author and forum are on the same machine
|
||||
if (!empty($item['forum_mode'])) {
|
||||
if (($item['gravity'] == GRAVITY_PARENT) && !empty($item['forum_mode'])) {
|
||||
$author = Contact::getById($item['author-id'], ['nurl']);
|
||||
if (!empty($author['nurl'])) {
|
||||
$self = Contact::selectFirst(['uid'], ['nurl' => $author['nurl'], 'self' => true]);
|
||||
if (!empty($self['uid'])) {
|
||||
$forum_item = Post::selectFirst([], ['uri-id' => $item['uri-id'], 'uid' => $self['uid']]);
|
||||
if (DBA::isResult($item)) {
|
||||
$forum_item = Post::selectFirst(Item::DELIVER_FIELDLIST, ['uri-id' => $item['uri-id'], 'uid' => $self['uid']]);
|
||||
if (DBA::isResult($forum_item)) {
|
||||
$item = $forum_item;
|
||||
}
|
||||
}
|
||||
|
@ -1645,7 +1645,7 @@ class Transmitter
|
|||
return [];
|
||||
}
|
||||
|
||||
$reshared_item = Post::selectFirst([], ['guid' => $reshared['guid']]);
|
||||
$reshared_item = Post::selectFirst(Item::DELIVER_FIELDLIST, ['guid' => $reshared['guid']]);
|
||||
if (!DBA::isResult($reshared_item)) {
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -887,9 +887,9 @@ class Feed
|
|||
$params = ['order' => ['received' => true], 'limit' => $max_items];
|
||||
|
||||
if ($filter === 'posts') {
|
||||
$ret = Post::selectThread([], $condition, $params);
|
||||
$ret = Post::selectThread(Item::DELIVER_FIELDLIST, $condition, $params);
|
||||
} else {
|
||||
$ret = Post::select([], $condition, $params);
|
||||
$ret = Post::select(Item::DELIVER_FIELDLIST, $condition, $params);
|
||||
}
|
||||
|
||||
$items = Post::toArray($ret);
|
||||
|
@ -1041,7 +1041,7 @@ class Feed
|
|||
|
||||
$condition = ['uid' => $owner["uid"], 'guid' => $repeated_guid, 'private' => [Item::PUBLIC, Item::UNLISTED],
|
||||
'network' => Protocol::FEDERATED];
|
||||
$repeated_item = Post::selectFirst([], $condition);
|
||||
$repeated_item = Post::selectFirst(Item::DELIVER_FIELDLIST, $condition);
|
||||
if (!DBA::isResult($repeated_item)) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue