3 * @file include/remove_contact.php
4 * @brief Removes orphaned data from deleted contacts
7 use \Friendica\Core\Config;
9 function remove_contact_run($argv, $argc) {
14 $id = intval($argv[1]);
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)) {
22 q("DELETE FROM `item` WHERE `contact-id` = %d", intval($id));
24 q("DELETE FROM `photo` WHERE `contact-id` = %d", intval($id));
26 q("DELETE FROM `mail` WHERE `contact-id` = %d", intval($id));
28 q("DELETE FROM `event` WHERE `cid` = %d", intval($id));
30 q("DELETE FROM `queue` WHERE `cid` = %d", intval($id));