]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/Contact/Remove.php
Added comment
[friendica.git] / src / Worker / Contact / Remove.php
index a3378fd5aa1248391408d485da52492eca5961ea..fbede2cdaf199a1c86593b44fac34f67586ecb61 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
  *
@@ -29,19 +29,21 @@ use Friendica\Database\DBA;
  */
 class Remove extends RemoveContent
 {
-       public static function execute(int $id): array
+       public static function execute(int $id): bool
        {
-               $contact = parent::execute($id);
+               // 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 false;
+               }
 
-               if (!empty($contact)) {
-                       return [];
+               if (!parent::execute($id)) {
+                       return false;
                }
 
                $ret = DBA::delete('contact', ['id' => $id]);
                Logger::info('Deleted contact', ['id' => $id, 'result' => $ret]);
 
-               $contact['id'] = null;
-
-               return $contact;
+               return true;
        }
 }