]> git.mxchange.org Git - friendica.git/commitdiff
Ensure that deleted contacts are really removed
authorMichael <heluecht@pirati.ca>
Sat, 11 Jan 2020 17:22:37 +0000 (17:22 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 11 Jan 2020 17:22:37 +0000 (17:22 +0000)
src/Worker/Cron.php
src/Worker/RemoveContact.php

index f0c85f66866a2c8af569c96907a1df78eb9e318c..2d46ce328d12440e7e1f9e41ae9dbb1c155455a3 100644 (file)
@@ -84,6 +84,8 @@ class Cron
                        // check upstream version?
                        Worker::add(PRIORITY_LOW, 'CheckVersion');
 
+                       self::checkdeletedContacts();
+
                        Config::set('system', 'last_expire_day', $d2);
                }
 
@@ -121,6 +123,19 @@ class Cron
                return;
        }
 
+       /**
+        * Checks for contacts that are about to be deleted and ensures that they are removed.
+        * This should be done automatically in the "remove" function. This here is a cleanup job.
+        */
+       private static function checkdeletedContacts()
+       {
+               $contacts = DBA::select('contact', ['id'], ['deleted' => true]);
+               while ($contact = DBA::fetch($contacts)) {
+                       Worker::add(PRIORITY_MEDIUM, 'RemoveContact', $contact['id']);
+               }
+               DBA::close($contacts);
+       }
+
        /**
         * @brief Update public contacts
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
index 00027dca40a2e46dd2b78352a274885634ff0519..2f005cd1470c76fc7826b73f5419c7a167313da3 100644 (file)
@@ -13,8 +13,7 @@ class RemoveContact {
        public static function execute($id) {
 
                // Only delete if the contact is to be deleted
-               $condition = ['network' => Protocol::PHANTOM, 'id' => $id];
-               $contact = DBA::selectFirst('contact', ['uid'], $condition);
+               $contact = DBA::selectFirst('contact', ['uid'], ['deleted' => true]);
                if (!DBA::isResult($contact)) {
                        return;
                }