]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/RemoveContact.php
Merge pull request #9044 from annando/avatar-stuff
[friendica.git] / src / Worker / RemoveContact.php
index 28a32160a014c7c830f5f5d5fb71952701792030..05771e2dc5c0ee5d1e494bcb5bfc552160df8711 100644 (file)
@@ -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]);
        }
 }