]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/Contact/RemoveContent.php
Merge pull request #12277 from nupplaphil/mod/fbrowser
[friendica.git] / src / Worker / Contact / RemoveContent.php
index f0e6e631d798b4be5f2afaf09e1669bf5e76c365..239192102fc3c95ec87db7e957a65c632dfc1ada 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -33,19 +33,13 @@ use Friendica\Model\Post;
  */
 class RemoveContent
 {
-       public static function execute(int $id): array
+       public static function execute(int $id): bool
        {
                if (empty($id)) {
-                       return [];
+                       return false;
                }
 
-               // Only delete if the contact is to be deleted
-               $contact = DBA::selectFirst('contact', ['id', 'uid', 'url', 'nick', 'name'], ['deleted' => true, 'id' => $id]);
-               if (!DBA::isResult($contact)) {
-                       return [];
-               }
-
-               Logger::info('Start deleting contact content', ['contact' => $contact]);
+               Logger::info('Start deleting contact content', ['cid' => $id]);
 
                // Now we delete the contact and all depending tables
                DBA::delete('post-tag', ['cid' => $id]);
@@ -80,13 +74,13 @@ class RemoveContent
                DBA::delete('contact-relation', ['relation-cid' => $id]);
                DBA::delete('contact-relation', ['cid' => $id]);
                DBA::delete('event', ['cid' => $id]);
-               DBA::delete('fsuggest', ['cid' => $id]);
+               DI::fsuggest()->delete(DI::fsuggest()->selectForContact($id));
                DBA::delete('post-tag', ['cid' => $id]);
                DBA::delete('user-contact', ['cid' => $id]);
 
                DBA::delete('group_member', ['contact-id' => $id]);
                DI::intro()->delete(DI::introFactory()->createDummy($id));
 
-               return $contact;
+               return true;
        }
 }