From 49d12b5faed1d945460e06aa5267950a761740c2 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 12 Apr 2019 08:50:44 -0400 Subject: [PATCH] Remove probing in magic link construction - Use Contact::getProbeDataFromDatabase and Contact::magicLinkByContact instead of Contact::getIdForURL and Contact::magicLinkbyId in Contact::magicLink - Add default value for $cid parameter in Contact::getProbeDataFromDatabase --- src/Model/Contact.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 85d1bfe9ad..24c2bf878c 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1127,7 +1127,7 @@ class Contact extends BaseObject * * @return array Contact array in the "probe" structure */ - private static function getProbeDataFromDatabase($url, $cid) + private static function getProbeDataFromDatabase($url, $cid = null) { // The link could be provided as http although we stored it as https $ssl_url = str_replace('http://', 'https://', $url); @@ -2249,12 +2249,12 @@ class Contact extends BaseObject return $url ?: $contact_url; // Equivalent to: ($url != '') ? $url : $contact_url; } - $cid = self::getIdForURL($contact_url, 0, true); - if (empty($cid)) { + $data = self::getProbeDataFromDatabase($contact_url); + if (empty($data)) { return $url ?: $contact_url; // Equivalent to: ($url != '') ? $url : $contact_url; } - return self::magicLinkbyId($cid, $url); + return self::magicLinkByContact($data, $contact_url); } /**