Merge pull request #1069 from annando/post
"Post" classes are now used instead of "Item"pull/1071/head
commit
21bb90f677
|
@ -389,7 +389,7 @@ function pumpio_hook_fork(App $a, array &$b)
|
||||||
|
|
||||||
if (DI::pConfig()->get($post['uid'], 'pumpio', 'import')) {
|
if (DI::pConfig()->get($post['uid'], 'pumpio', 'import')) {
|
||||||
// Don't fork if it isn't a reply to a pump.io post
|
// 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']);
|
Logger::log('No pump.io parent found for item ' . $post['id']);
|
||||||
$b['execute'] = false;
|
$b['execute'] = false;
|
||||||
return;
|
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']];
|
$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']);
|
Logger::log("pumpio_dolike: found existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1065,13 +1065,13 @@ function pumpio_dodelete(App $a, $uid, $self, $post, $own_id)
|
||||||
{
|
{
|
||||||
// Two queries for speed issues
|
// Two queries for speed issues
|
||||||
$condition = ['uri' => $post->object->id, 'uid' => $uid];
|
$condition = ['uri' => $post->object->id, 'uid' => $uid];
|
||||||
if (Item::exists($condition)) {
|
if (Post::exists($condition)) {
|
||||||
Item::markForDeletion($condition);
|
Item::markForDeletion($condition);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$condition = ['extid' => $post->object->id, 'uid' => $uid];
|
$condition = ['extid' => $post->object->id, 'uid' => $uid];
|
||||||
if (Item::exists($condition)) {
|
if (Post::exists($condition)) {
|
||||||
Item::markForDeletion($condition);
|
Item::markForDeletion($condition);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1094,10 +1094,10 @@ function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcomp
|
||||||
|
|
||||||
if ($post->verb != "update") {
|
if ($post->verb != "update") {
|
||||||
// Two queries for speed issues
|
// 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;
|
return false;
|
||||||
}
|
}
|
||||||
if (Item::exists(['extid' => $post->object->id, 'uid' => $uid])) {
|
if (Post::exists(['extid' => $post->object->id, 'uid' => $uid])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1561,11 +1561,11 @@ function pumpio_fetchallcomments(App $a, $uid, $id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checking if the comment already exists - Two queries for speed issues
|
// 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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Item::exists(['extid' => $item->id, 'uid' => $uid])) {
|
if (Post::exists(['extid' => $item->id, 'uid' => $uid])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -403,7 +403,7 @@ function statusnet_hook_fork(App $a, array &$b)
|
||||||
|
|
||||||
if (DI::pConfig()->get($post['uid'], 'statusnet', 'import')) {
|
if (DI::pConfig()->get($post['uid'], 'statusnet', 'import')) {
|
||||||
// Don't fork if it isn't a reply to a GNU Social post
|
// 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']);
|
Logger::log('No GNU Social parent found for item ' . $post['id']);
|
||||||
$b['execute'] = false;
|
$b['execute'] = false;
|
||||||
return;
|
return;
|
||||||
|
@ -1098,7 +1098,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
||||||
|
|
||||||
$postarray['uri'] = $hostname . "::" . $content->id;
|
$postarray['uri'] = $hostname . "::" . $content->id;
|
||||||
|
|
||||||
if (Item::exists(['extid' => $postarray['uri'], 'uid' => $uid])) {
|
if (Post::exists(['extid' => $postarray['uri'], 'uid' => $uid])) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -411,7 +411,7 @@ function twitter_hook_fork(App $a, array &$b)
|
||||||
|
|
||||||
if (DI::pConfig()->get($post['uid'], 'twitter', 'import')) {
|
if (DI::pConfig()->get($post['uid'], 'twitter', 'import')) {
|
||||||
// Don't fork if it isn't a reply to a twitter post
|
// 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']]);
|
Logger::notice('No twitter parent found', ['item' => $post['id']]);
|
||||||
$b['execute'] = false;
|
$b['execute'] = false;
|
||||||
return;
|
return;
|
||||||
|
@ -851,8 +851,8 @@ function twitter_expire(App $a)
|
||||||
|
|
||||||
Logger::notice('Start deleting expired posts');
|
Logger::notice('Start deleting expired posts');
|
||||||
|
|
||||||
$r = Item::select(['id', 'guid'], ['deleted' => true, 'network' => Protocol::TWITTER]);
|
$r = Post::select(['id', 'guid'], ['deleted' => true, 'network' => Protocol::TWITTER]);
|
||||||
while ($row = DBA::fetch($r)) {
|
while ($row = Post::fetch($r)) {
|
||||||
Logger::info('[twitter] Delete expired item', ['id' => $row['id'], 'guid' => $row['guid'], 'callstack' => \Friendica\Core\System::callstack()]);
|
Logger::info('[twitter] Delete expired item', ['id' => $row['id'], 'guid' => $row['guid'], 'callstack' => \Friendica\Core\System::callstack()]);
|
||||||
DBA::delete('item', ['id' => $row['id']]);
|
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
|
// 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']]);
|
Logger::info('Item found', ['extid' => $postarray['uri']]);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -1802,7 +1802,7 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Item::exists(['uri' => 'twitter::' . $post->id_str, 'uid' => $uid])) {
|
if (Post::exists(['uri' => 'twitter::' . $post->id_str, 'uid' => $uid])) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue