"Post" classes are now used instead of "Item"

This commit is contained in:
Michael 2021-01-19 09:14:14 +00:00
parent 1533d9a758
commit b4644212d4
3 changed files with 15 additions and 15 deletions

View file

@ -389,7 +389,7 @@ function pumpio_hook_fork(App $a, array &$b)
if (DI::pConfig()->get($post['uid'], 'pumpio', 'import')) {
// Don't fork if it isn't a reply to a pump.io post
if (($post['parent'] != $post['id']) && !Item::exists(['id' => $post['parent'], 'network' => Protocol::PUMPIO])) {
if (($post['parent'] != $post['id']) && !Post::exists(['id' => $post['parent'], 'network' => Protocol::PUMPIO])) {
Logger::log('No pump.io parent found for item ' . $post['id']);
$b['execute'] = false;
return;
@ -954,7 +954,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion =
}
$condition = ['verb' => Activity::LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']];
if (Item::exists($condition)) {
if (Post::exists($condition)) {
Logger::log("pumpio_dolike: found existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
return;
}
@ -1065,13 +1065,13 @@ function pumpio_dodelete(App $a, $uid, $self, $post, $own_id)
{
// Two queries for speed issues
$condition = ['uri' => $post->object->id, 'uid' => $uid];
if (Item::exists($condition)) {
if (Post::exists($condition)) {
Item::markForDeletion($condition);
return true;
}
$condition = ['extid' => $post->object->id, 'uid' => $uid];
if (Item::exists($condition)) {
if (Post::exists($condition)) {
Item::markForDeletion($condition);
return true;
}
@ -1094,10 +1094,10 @@ function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcomp
if ($post->verb != "update") {
// Two queries for speed issues
if (Item::exists(['uri' => $post->object->id, 'uid' => $uid])) {
if (Post::exists(['uri' => $post->object->id, 'uid' => $uid])) {
return false;
}
if (Item::exists(['extid' => $post->object->id, 'uid' => $uid])) {
if (Post::exists(['extid' => $post->object->id, 'uid' => $uid])) {
return false;
}
}
@ -1561,11 +1561,11 @@ function pumpio_fetchallcomments(App $a, $uid, $id)
}
// Checking if the comment already exists - Two queries for speed issues
if (Item::exists(['uri' => $item->id, 'uid' => $uid])) {
if (Post::exists(['uri' => $item->id, 'uid' => $uid])) {
continue;
}
if (Item::exists(['extid' => $item->id, 'uid' => $uid])) {
if (Post::exists(['extid' => $item->id, 'uid' => $uid])) {
continue;
}

View file

@ -403,7 +403,7 @@ function statusnet_hook_fork(App $a, array &$b)
if (DI::pConfig()->get($post['uid'], 'statusnet', 'import')) {
// Don't fork if it isn't a reply to a GNU Social post
if (($post['parent'] != $post['id']) && !Item::exists(['id' => $post['parent'], 'network' => Protocol::STATUSNET])) {
if (($post['parent'] != $post['id']) && !Post::exists(['id' => $post['parent'], 'network' => Protocol::STATUSNET])) {
Logger::log('No GNU Social parent found for item ' . $post['id']);
$b['execute'] = false;
return;
@ -1098,7 +1098,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
$postarray['uri'] = $hostname . "::" . $content->id;
if (Item::exists(['extid' => $postarray['uri'], 'uid' => $uid])) {
if (Post::exists(['extid' => $postarray['uri'], 'uid' => $uid])) {
return [];
}

View file

@ -411,7 +411,7 @@ function twitter_hook_fork(App $a, array &$b)
if (DI::pConfig()->get($post['uid'], 'twitter', 'import')) {
// Don't fork if it isn't a reply to a twitter post
if (($post['parent'] != $post['id']) && !Item::exists(['id' => $post['parent'], 'network' => Protocol::TWITTER])) {
if (($post['parent'] != $post['id']) && !Post::exists(['id' => $post['parent'], 'network' => Protocol::TWITTER])) {
Logger::notice('No twitter parent found', ['item' => $post['id']]);
$b['execute'] = false;
return;
@ -851,8 +851,8 @@ function twitter_expire(App $a)
Logger::notice('Start deleting expired posts');
$r = Item::select(['id', 'guid'], ['deleted' => true, 'network' => Protocol::TWITTER]);
while ($row = DBA::fetch($r)) {
$r = Post::select(['id', 'guid'], ['deleted' => true, 'network' => Protocol::TWITTER]);
while ($row = Post::fetch($r)) {
Logger::info('[twitter] Delete expired item', ['id' => $row['id'], 'guid' => $row['guid'], 'callstack' => \Friendica\Core\System::callstack()]);
DBA::delete('item', ['id' => $row['id']]);
}
@ -1591,7 +1591,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
}
// Don't import our own comments
if (Item::exists(['extid' => $postarray['uri'], 'uid' => $uid])) {
if (Post::exists(['extid' => $postarray['uri'], 'uid' => $uid])) {
Logger::info('Item found', ['extid' => $postarray['uri']]);
return [];
}
@ -1802,7 +1802,7 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection,
break;
}
if (Item::exists(['uri' => 'twitter::' . $post->id_str, 'uid' => $uid])) {
if (Post::exists(['uri' => 'twitter::' . $post->id_str, 'uid' => $uid])) {
break;
}