From: Michael <heluecht@pirati.ca>
Date: Wed, 24 Oct 2018 04:50:27 +0000 (+0000)
Subject: Improve query speed
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a6f6db8d4ec9406b93689aaf4a1da2e2524e42c9;p=friendica.git

Improve query speed
---

diff --git a/src/Worker/RemoveContact.php b/src/Worker/RemoveContact.php
index 8485adda6b..2e3f16db3e 100644
--- a/src/Worker/RemoveContact.php
+++ b/src/Worker/RemoveContact.php
@@ -16,13 +16,13 @@ class RemoveContact {
 
 		// Only delete if the contact is to be deleted
 		$condition = ['network' => Protocol::PHANTOM, 'id' => $id];
-		$r = DBA::exists('contact', $condition);
-		if (!DBA::isResult($r)) {
+		$contact = DBA::selectFirst('contact', ['uid'], $condition);
+		if (!DBA::isResult($contact)) {
 			return;
 		}
 
 		// Now we delete the contact and all depending tables
-		$condition = ['contact-id' => $id];
+		$condition = ['uid' => $contact['uid'], 'contact-id' => $id];
 		do {
 			$items = Item::select(['id'], $condition, ['limit' => 100]);
 			while ($item = Item::fetch($items)) {