X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fremove_contact.php;h=a3938ad8ecbe390a7d52b612efea226963607d0a;hb=ce866ad39beee9bc0fa856152c21ea745da5ee81;hp=ec8b83eab933809261455d1ed65447072bf7b033;hpb=fc3c1601b1d8de58aff2457f6e116ea226c69ced;p=friendica.git diff --git a/include/remove_contact.php b/include/remove_contact.php index ec8b83eab9..a3938ad8ec 100644 --- a/include/remove_contact.php +++ b/include/remove_contact.php @@ -3,25 +3,10 @@ * @file include/remove_contact.php * @brief Removes orphaned data from deleted contacts */ -require_once("boot.php"); -function remove_contact_run($argv, $argc) { - global $a, $db; - - if (is_null($a)) { - $a = new App; - } - - if (is_null($db)) { - @include(".htconfig.php"); - require_once("include/dba.php"); - $db = new dba($db_host, $db_user, $db_pass, $db_data); - unset($db_host, $db_user, $db_pass, $db_data); - } - - load_config('config'); - load_config('system'); +use Friendica\Core\Config; +function remove_contact_run($argv, $argc) { if ($argc != 2) { return; } @@ -34,19 +19,6 @@ function remove_contact_run($argv, $argc) { return; } - q("DELETE FROM `item` WHERE `contact-id` = %d", intval($id)); - - q("DELETE FROM `photo` WHERE `contact-id` = %d", intval($id)); - - q("DELETE FROM `mail` WHERE `contact-id` = %d", intval($id)); - - q("DELETE FROM `event` WHERE `cid` = %d", intval($id)); - - q("DELETE FROM `queue` WHERE `cid` = %d", intval($id)); -} - -if (array_search(__file__, get_included_files()) === 0) { - remove_contact_run($_SERVER["argv"], $_SERVER["argc"]); - killme(); + // Now we delete all the depending table entries + dba::delete('contact', array('id' => $id)); } -?>