<?php
/**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
return DBA::selectFirst('contact', $fields, ['id' => $id]);
}
+ /**
+ * Fetch the first contact with the provided uri-id.
+ *
+ * @param integer $uri_id uri-id of the contact
+ * @param array $fields Array of selected fields, empty for all
+ * @return array|boolean Contact record if it exists, false otherwise
+ * @throws \Exception
+ */
+ public static function getByUriId($uri_id, $fields = [])
+ {
+ return DBA::selectFirst('contact', $fields, ['uri-id' => $uri_id], ['order' => ['uid']]);
+ }
+
/**
* Fetches a contact by a given url
*
Logger::info('Contact will be updated', ['url' => $url, 'uid' => $uid, 'update' => $update, 'cid' => $contact_id]);
}
+ if ($data['network'] == Protocol::DIASPORA) {
+ FContact::updateFromProbeArray($data);
+ }
+
self::updateFromProbeArray($contact_id, $data);
// Don't return a number for a deleted account
}
$ret = Probe::uri($contact['url'], $network, $contact['uid']);
+
+ if ($ret['network'] == Protocol::DIASPORA) {
+ FContact::updateFromProbeArray($ret);
+ }
+
return self::updateFromProbeArray($id, $ret);
}