]> git.mxchange.org Git - friendica.git/commitdiff
Only delete uid=0 entries when cleaning up extra public entries
authorDean Townsley <dean@townsley.com>
Sat, 8 Jul 2017 14:55:40 +0000 (09:55 -0500)
committerDean Townsley <dean@townsley.com>
Sat, 8 Jul 2017 14:55:40 +0000 (09:55 -0500)
This delete can inadvertently remove contacts from normal users under
some conditions.  Since it appears to be intended to only operate on
"public" (uid=0) contacts, this change constrains the delete query to
only uid=0 records.

include/Contact.php

index 0aeabc9725cc226074e37a37864cd56c936cf811..f99b0d5d0fbf078e4eecb6ca3f2bebc918d5f26e 100644 (file)
@@ -637,7 +637,7 @@ function get_contact($url, $uid = 0, $no_update = false) {
        }
 
        if (count($contacts) > 1 && $uid == 0 && $contact_id != 0 && $url != "") {
-               q("DELETE FROM `contact` WHERE `nurl` = '%s' AND `id` != %d AND NOT `self`",
+               q("DELETE FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0 AND `id` != %d AND NOT `self`",
                        dbesc(normalise_link($url)),
                        intval($contact_id));
        }