All item selects are now done by the post class

This commit is contained in:
Michael 2021-01-19 07:23:01 +00:00
parent 2d0443a109
commit b892db0cf3
16 changed files with 108 additions and 688 deletions

View file

@ -356,9 +356,9 @@ class Community extends BaseModule
}
}
$r = Item::selectThreadForUser(0, ['uri', 'commented', 'author-link'], $condition, $params);
$r = Post::selectThreadForUser(0, ['uri', 'commented', 'author-link'], $condition, $params);
$items = DBA::toArray($r);
$items = Post::toArray($r);
// Previous page case: once we get the relevant items closest to min_id, we need to restore the expected display order
if (empty($item_id) && isset($min_id) && !isset($max_id)) {

View file

@ -228,8 +228,8 @@ class Status extends BaseProfile
$condition = [];
}
$pinned_items = Item::selectPinned($a->profile['uid'], ['uri', 'pinned'], $condition);
$pinned = Item::toArray($pinned_items);
$pinned_items = Post::selectPinned($a->profile['uid'], ['uri', 'pinned'], $condition);
$pinned = Post::toArray($pinned_items);
$items = array_merge($items, $pinned);
}

View file

@ -28,6 +28,7 @@ use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\Post;
use Friendica\Module\BaseSettings;
/**
@ -245,7 +246,7 @@ class UserExport extends BaseSettings
// chunk the output to avoid exhausting memory
for ($x = 0; $x < $total; $x += 500) {
$items = Item::selectToArray(Item::ITEM_FIELDLIST, ['uid' => local_user()], ['limit' => [$x, 500]]);
$items = Post::selectToArray(Item::ITEM_FIELDLIST, ['uid' => local_user()], ['limit' => [$x, 500]]);
$output = ['item' => $items];
echo json_encode($output, JSON_PARTIAL_OUTPUT_ON_ERROR). "\n";
}