Use the Item class instead of DBA calls when possible
This commit is contained in:
parent
1283b99c6f
commit
e8334c4655
5 changed files with 23 additions and 21 deletions
|
@ -247,7 +247,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
|||
}
|
||||
|
||||
// We are displaying an "alternate" link if that post was public. See issue 2864
|
||||
$is_public = DBA::exists('item', ['id' => $item_id, 'private' => [0, 2]]);
|
||||
$is_public = Item::exists(['id' => $item_id, 'private' => [0, 2]]);
|
||||
if ($is_public) {
|
||||
// For the atom feed the nickname doesn't matter at all, we only need the item id.
|
||||
$alternate = System::baseUrl().'/display/feed-item/'.$item_id.'.atom';
|
||||
|
@ -324,7 +324,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
|||
|
||||
if (local_user() && (local_user() == $a->profile['uid'])) {
|
||||
$condition = ['parent-uri' => $item_parent_uri, 'uid' => local_user(), 'unseen' => true];
|
||||
$unseen = DBA::exists('item', $condition);
|
||||
$unseen = Item::exists($condition);
|
||||
} else {
|
||||
$unseen = false;
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ function item_post(App $a) {
|
|||
|
||||
// Check for multiple posts with the same message id (when the post was created via API)
|
||||
if (($message_id != '') && ($profile_uid != 0)) {
|
||||
if (DBA::exists('item', ['uri' => $message_id, 'uid' => $profile_uid])) {
|
||||
if (Item::exists(['uri' => $message_id, 'uid' => $profile_uid])) {
|
||||
logger("Message with URI ".$message_id." already exists for user ".$profile_uid, LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -318,7 +318,7 @@ function networkSetSeen($condition)
|
|||
return;
|
||||
}
|
||||
|
||||
$unseen = DBA::exists('item', $condition);
|
||||
$unseen = Item::exists($condition);
|
||||
|
||||
if ($unseen) {
|
||||
$r = Item::update(['unseen' => false], $condition);
|
||||
|
|
|
@ -347,7 +347,7 @@ function profile_content(App $a, $update = 0)
|
|||
|
||||
|
||||
if ($is_owner) {
|
||||
$unseen = DBA::exists('item', ['wall' => true, 'unseen' => true, 'uid' => local_user()]);
|
||||
$unseen = Item::exists(['wall' => true, 'unseen' => true, 'uid' => local_user()]);
|
||||
if ($unseen) {
|
||||
$r = Item::update(['unseen' => false],
|
||||
['wall' => true, 'unseen' => true, 'uid' => local_user()]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue