- // 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']]);
+ if (DBStructure::existsTable('thread')) {
+ 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']]);