]> git.mxchange.org Git - friendica.git/blob - include/remove_contact.php
Issue 2957: The avatar problem with mastodon should now finally be solved
[friendica.git] / include / remove_contact.php
1 <?php
2 /**
3  * @file include/remove_contact.php
4  * @brief Removes orphaned data from deleted contacts
5  */
6
7 use \Friendica\Core\Config;
8
9 function remove_contact_run($argv, $argc) {
10         if ($argc != 2) {
11                 return;
12         }
13
14         $id = intval($argv[1]);
15
16         // Only delete if the contact doesn't exist (anymore)
17         $r = q("SELECT `id` FROM `contact` WHERE `id` = %d", intval($id));
18         if (dbm::is_result($r)) {
19                 return;
20         }
21
22         q("DELETE FROM `item` WHERE `contact-id` = %d", intval($id));
23
24         q("DELETE FROM `photo` WHERE `contact-id` = %d", intval($id));
25
26         q("DELETE FROM `mail` WHERE `contact-id` = %d", intval($id));
27
28         q("DELETE FROM `event` WHERE `cid` = %d", intval($id));
29
30         q("DELETE FROM `queue` WHERE `cid` = %d", intval($id));
31 }
32 ?>