From: Michael Date: Sat, 11 Jan 2020 17:22:37 +0000 (+0000) Subject: Ensure that deleted contacts are really removed X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0225e99d0a2faa112d2ef9c949f2ee1fe2c6a115;p=friendica.git Ensure that deleted contacts are really removed --- diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index f0c85f6686..2d46ce328d 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -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 diff --git a/src/Worker/RemoveContact.php b/src/Worker/RemoveContact.php index 00027dca40..2f005cd147 100644 --- a/src/Worker/RemoveContact.php +++ b/src/Worker/RemoveContact.php @@ -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; }