* Have a look at all contact tables for a given profile url.
* This function works as a replacement for probing the contact.
*
- * @param string $url Contact URL
+ * @param string $url Contact URL
+ * @param integer $cid Contact ID
*
* @return array Contact array in the "probe" structure
*/
- private static function getProbeDataFromDatabase($url)
+ private static function getProbeDataFromDatabase($url, $cid)
{
// The link could be provided as http although we stored it as https
$ssl_url = str_replace('http://', 'https://', $url);
$fields = ['url', 'addr', 'alias', 'notify', 'poll', 'name', 'nick',
'photo', 'keywords', 'location', 'about', 'network',
'priority', 'batch', 'request', 'confirm', 'poco'];
+
+ if (!empty($cid)) {
+ $data = DBA::selectFirst('contact', $fields, ['id' => $cid]);
+ if (DBA::isResult($data)) {
+ return $data;
+ }
+ }
+
$data = DBA::selectFirst('contact', $fields, ['nurl' => Strings::normaliseLink($url)]);
if (!DBA::isResult($data)) {
// When we don't want to update, we look if we know this contact in any way
if ($no_update && empty($default)) {
- $data = self::getProbeDataFromDatabase($url);
+ $data = self::getProbeDataFromDatabase($url, $contact_id);
$background_update = true;
} else {
$data = [];
return 0;
}
- $contact = array_merge(self::getProbeDataFromDatabase($url), $default);
+ $contact = array_merge(self::getProbeDataFromDatabase($url, $contact_id), $default);
if (empty($contact)) {
return 0;
}