}
/**
+ * Updates contact record by provided id and optional network
+ *
* @param integer $id contact id
* @param string $network Optional network we are probing for
* @return boolean
}
/**
+ * Updates contact record by provided id and probed data
+ *
* @param integer $id contact id
* @param array $ret Probed data
* @return boolean
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- private static function updateFromProbeArray(int $id, array $ret)
+ private static function updateFromProbeArray(int $id, array $ret): bool
{
/*
Warning: Never ever fetch the public key via Probe::uri and write it into the contacts.
}
/**
+ * Updates contact record by provided URL
+ *
* @param integer $url contact url
* @return integer Contact id
* @throws HTTPException\InternalServerErrorException
$posts = Post::countPosts(['author-id' => $contact['id'], 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]]);
}
- $fields = ['name' => $arr["name"], 'photo' => $arr["photo"],
- 'request' => $arr["request"], 'nick' => $arr["nick"],
- 'addr' => strtolower($arr["addr"]), 'guid' => $arr["guid"],
- 'batch' => $arr["batch"], 'notify' => $arr["notify"],
- 'poll' => $arr["poll"], 'confirm' => $arr["confirm"],
- 'alias' => $arr["alias"], 'pubkey' => $arr["pubkey"],
- 'uri-id' => $uriid, 'interacting_count' => $interacting ?? 0,
- 'interacted_count' => $interacted ?? 0, 'post_count' => $posts ?? 0,
- 'updated' => DateTimeFormat::utcNow()];
-
- $condition = ['url' => $arr["url"], 'network' => $arr["network"]];
+ $fields = [
+ 'name' => $arr['name'],
+ 'photo' => $arr['photo'],
+ 'request' => $arr['request'],
+ 'nick' => $arr['nick'],
+ 'addr' => strtolower($arr['addr']),
+ 'guid' => $arr['guid'],
+ 'batch' => $arr['batch'],
+ 'notify' => $arr['notify'],
+ 'poll' => $arr['poll'],
+ 'confirm' => $arr['confirm'],
+ 'alias' => $arr['alias'],
+ 'pubkey' => $arr['pubkey'],
+ 'uri-id' => $uriid,
+ 'interacting_count' => $interacting ?? 0,
+ 'interacted_count' => $interacted ?? 0,
+ 'post_count' => $posts ?? 0,
+ 'updated' => DateTimeFormat::utcNow(),
+ ];
+
+ $condition = ['url' => $arr['url'], 'network' => $arr['network']];
DBA::update('fcontact', $fields, $condition, true);
}
* fcontact guid
*
* @param string $fcontact_guid Hexadecimal string guid
- *
* @return string|null the contact url or null
* @throws \Exception
*/
class OnePoll
{
- public static function execute($contact_id = 0, $command = '')
+ public static function execute(int $contact_id = 0, string $command = '')
{
Logger::notice('Start polling/probing contact', ['id' => $contact_id]);
- $force = ($command == "force");
+ $force = ($command == 'force');
if (empty($contact_id)) {
Logger::notice('no contact provided');
*
* @param array $contact The personal contact entry
* @param array $fields The fields that are updated
+ * @return void
* @throws \Exception
*/
private static function updateContact(array $contact, array $fields)