2016-11-28 16:44:04 -05:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @file include/remove_contact.php
|
|
|
|
* @brief Removes orphaned data from deleted contacts
|
|
|
|
*/
|
2017-01-18 16:45:32 -05:00
|
|
|
|
|
|
|
use \Friendica\Core\Config;
|
|
|
|
|
2016-11-28 16:44:04 -05:00
|
|
|
function remove_contact_run($argv, $argc) {
|
|
|
|
if ($argc != 2) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$id = intval($argv[1]);
|
|
|
|
|
|
|
|
// Only delete if the contact doesn't exist (anymore)
|
|
|
|
$r = q("SELECT `id` FROM `contact` WHERE `id` = %d", intval($id));
|
|
|
|
if (dbm::is_result($r)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-05-01 02:35:41 -04:00
|
|
|
// Now we delete all the depending table entries
|
|
|
|
dba::delete('contact', array('id' => $id));
|
2016-11-28 16:44:04 -05:00
|
|
|
}
|