]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/RemoveContact.php
Merge pull request #5903 from nupplaphil/move_module_acctlink
[friendica.git] / src / Worker / RemoveContact.php
index 4098d66bc59648c227fc170b187356c76209b5d7..8f986eab11559c18630315429dd783910dfa9205 100644 (file)
@@ -5,21 +5,22 @@
  */
 namespace Friendica\Worker;
 
-use Friendica\Core\Config;
-use dba;
+use Friendica\Database\DBA;
+use Friendica\Core\Protocol;
 
 require_once 'include/dba.php';
 
 class RemoveContact {
        public static function execute($id) {
 
-               // Only delete if the contact doesn't exist (anymore)
-               $r = dba::exists('contact', array('id' => $id));
-               if ($r) {
+               // Only delete if the contact is to be deleted
+               $condition = ['network' => Protocol::PHANTOM, 'id' => $id];
+               $r = DBA::exists('contact', $condition);
+               if (!DBA::isResult($r)) {
                        return;
                }
 
-               // Now we delete all the depending table entries
-               dba::delete('contact', array('id' => $id));
+               // Now we delete the contact and all depending tables
+               DBA::delete('contact', ['id' => $id]);
        }
 }