diff --git a/src/Worker/ExpireAndRemoveUsers.php b/src/Worker/ExpireAndRemoveUsers.php index 1fda31a17..c8344b6fd 100644 --- a/src/Worker/ExpireAndRemoveUsers.php +++ b/src/Worker/ExpireAndRemoveUsers.php @@ -22,6 +22,7 @@ namespace Friendica\Worker; use Friendica\Database\DBA; +use Friendica\Model\Photo; use Friendica\Model\User; /** @@ -51,6 +52,8 @@ class ExpireAndRemoveUsers DBA::delete('contact', ['nurl' => $self['nurl'], 'self' => false]); } + Photo::delete(['uid' => $user['uid']]); + DBA::delete('user', ['uid' => $user['uid']]); } DBA::close($users); diff --git a/src/Worker/RemoveContact.php b/src/Worker/RemoveContact.php index 28a32160a..05771e2dc 100644 --- a/src/Worker/RemoveContact.php +++ b/src/Worker/RemoveContact.php @@ -23,8 +23,8 @@ namespace Friendica\Worker; use Friendica\Core\Logger; use Friendica\Database\DBA; -use Friendica\Core\Protocol; use Friendica\Model\Item; +use Friendica\Model\Photo; /** * Removes orphaned data from deleted contacts @@ -33,7 +33,7 @@ class RemoveContact { public static function execute($id) { // Only delete if the contact is to be deleted - $contact = DBA::selectFirst('contact', ['uid'], ['deleted' => true]); + $contact = DBA::selectFirst('contact', ['uid'], ['deleted' => true, 'id' => $id]); if (!DBA::isResult($contact)) { return; } @@ -49,6 +49,7 @@ class RemoveContact { DBA::close($items); } while (Item::exists($condition)); + Photo::delete(['uid' => $contact['uid'], 'contact-id' => $id]); DBA::delete('contact', ['id' => $id]); } }