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