]> git.mxchange.org Git - friendica.git/blob - src/Worker/RemoveContact.php
Fix notices in include/enotify
[friendica.git] / src / Worker / RemoveContact.php
1 <?php
2 /**
3  * @file src/Worker/RemoveContact.php
4  * @brief Removes orphaned data from deleted contacts
5  */
6 namespace Friendica\Worker;
7
8 use Friendica\Database\DBA;
9 use Friendica\Core\Protocol;
10
11 require_once 'include/dba.php';
12
13 class RemoveContact {
14         public static function execute($id) {
15
16                 // Only delete if the contact is to be deleted
17                 $condition = ['network' => Protocol::PHANTOM, 'id' => $id];
18                 $r = DBA::exists('contact', $condition);
19                 if (!DBA::isResult($r)) {
20                         return;
21                 }
22
23                 // Now we delete the contact and all depending tables
24                 DBA::delete('contact', ['id' => $id]);
25         }
26 }