X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FRemoveUnusedContacts.php;h=f93e3eb50716ac36eae5323d6d289bcddb34441d;hb=7d7d310cc4f8661751fd2a62e33405c98f78aa62;hp=f90abe369a15a5a060d71765ed24109c7d3c1c15;hpb=5e846dd7c29fe93e583c195e97513e221dac31b9;p=friendica.git diff --git a/src/Worker/RemoveUnusedContacts.php b/src/Worker/RemoveUnusedContacts.php index f90abe369a..f93e3eb507 100644 --- a/src/Worker/RemoveUnusedContacts.php +++ b/src/Worker/RemoveUnusedContacts.php @@ -1,6 +1,6 @@ $total]); @@ -54,6 +53,26 @@ class RemoveUnusedContacts DBA::delete('thread', ['owner-id' => $contact['id']]); DBA::delete('thread', ['author-id' => $contact['id']]); } + if (DBStructure::existsTable('item')) { + DBA::delete('item', ['owner-id' => $contact['id']]); + DBA::delete('item', ['author-id' => $contact['id']]); + DBA::delete('item', ['causer-id' => $contact['id']]); + } + + // There should be none entry for the contact in these tables when none was found in "post-user". + // But we want to be sure since the foreign key prohibits deletion otherwise. + DBA::delete('post', ['owner-id' => $contact['id']]); + DBA::delete('post', ['author-id' => $contact['id']]); + DBA::delete('post', ['causer-id' => $contact['id']]); + + DBA::delete('post-thread', ['owner-id' => $contact['id']]); + DBA::delete('post-thread', ['author-id' => $contact['id']]); + DBA::delete('post-thread', ['causer-id' => $contact['id']]); + + DBA::delete('post-thread-user', ['owner-id' => $contact['id']]); + DBA::delete('post-thread-user', ['author-id' => $contact['id']]); + DBA::delete('post-thread-user', ['causer-id' => $contact['id']]); + DBA::delete('contact', ['id' => $contact['id']]); if ((++$count % 1000) == 0) { Logger::notice('In removal', ['count' => $count, 'total' => $total]);