2017-11-17 17:16:34 -05:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @file src/Worker/RemoveContact.php
|
|
|
|
* @brief Removes orphaned data from deleted contacts
|
|
|
|
*/
|
|
|
|
namespace Friendica\Worker;
|
|
|
|
|
2018-07-19 22:15:21 -04:00
|
|
|
use Friendica\Database\dba;
|
2017-11-17 17:16:34 -05:00
|
|
|
|
2017-12-17 15:24:57 -05:00
|
|
|
require_once 'include/dba.php';
|
|
|
|
|
2017-11-17 17:16:34 -05:00
|
|
|
class RemoveContact {
|
|
|
|
public static function execute($id) {
|
|
|
|
|
|
|
|
// Only delete if the contact doesn't exist (anymore)
|
2018-01-15 08:05:12 -05:00
|
|
|
$r = dba::exists('contact', ['id' => $id]);
|
2017-11-17 17:16:34 -05:00
|
|
|
if ($r) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Now we delete all the depending table entries
|
2018-01-15 08:05:12 -05:00
|
|
|
dba::delete('contact', ['id' => $id]);
|
2017-11-17 17:16:34 -05:00
|
|
|
}
|
|
|
|
}
|