From b4644212d48256d636f9fbd063b228c23b03b2f0 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 19 Jan 2021 09:14:14 +0000 Subject: [PATCH] "Post" classes are now used instead of "Item" --- pumpio/pumpio.php | 16 ++++++++-------- statusnet/statusnet.php | 4 ++-- twitter/twitter.php | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 08e0ec9b..19f11190 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -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; } diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 00ae3ec8..5d1e164a 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -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 []; } diff --git a/twitter/twitter.php b/twitter/twitter.php index b2378a59..df23e341 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -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; }