Merge pull request #967 from MrPetovan/bug/7134-local-post-deleted

[pumpio] Rename Item::delete to Item::markForDeletion
This commit is contained in:
Michael Vogel 2020-03-11 03:45:55 +01:00 committed by GitHub
commit 93f8bbfe56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -914,7 +914,7 @@ function pumpio_dounlike(App $a, $uid, $self, $post, $own_id)
} }
} }
Item::delete(['verb' => Activity::LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']]); Item::markForDeletion(['verb' => Activity::LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']]);
if (DBA::isResult($r)) { if (DBA::isResult($r)) {
Logger::log("pumpio_dounlike: unliked existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']); Logger::log("pumpio_dounlike: unliked existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
@ -1082,13 +1082,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 (Item::exists($condition)) {
Item::delete($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 (Item::exists($condition)) {
Item::delete($condition); Item::markForDeletion($condition);
return true; return true;
} }
return false; return false;

View file

@ -808,8 +808,9 @@ function twitter_expire(App $a)
return; return;
} }
$r = Item::select(['id'], ['deleted' => true, 'network' => Protocol::TWITTER]); $r = Item::select(['id', 'guid'], ['deleted' => true, 'network' => Protocol::TWITTER]);
while ($row = DBA::fetch($r)) { while ($row = DBA::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']]); DBA::delete('item', ['id' => $row['id']]);
} }
DBA::close($r); DBA::close($r);