3 * @file src/Worker/OnePoll.php
5 namespace Friendica\Worker;
7 use Friendica\BaseObject;
8 use Friendica\Content\Text\BBCode;
9 use Friendica\Core\Config;
10 use Friendica\Core\Logger;
11 use Friendica\Core\PConfig;
12 use Friendica\Core\Protocol;
13 use Friendica\Database\DBA;
14 use Friendica\Model\APContact;
15 use Friendica\Model\Contact;
16 use Friendica\Model\Item;
17 use Friendica\Protocol\ActivityPub;
18 use Friendica\Protocol\Email;
19 use Friendica\Protocol\PortableContact;
20 use Friendica\Util\DateTimeFormat;
21 use Friendica\Util\Network;
22 use Friendica\Util\Strings;
23 use Friendica\Util\XML;
27 public static function execute($contact_id = 0, $command = '')
29 $a = BaseObject::getApp();
39 if ($command == "force") {
44 Logger::log('no contact');
48 $d = DateTimeFormat::utcNow();
50 $contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
51 if (!DBA::isResult($contact)) {
52 Logger::log('Contact not found or cannot be used.');
56 $importer_uid = $contact['uid'];
58 // Possibly switch the remote contact to AP
59 if ($contact['network'] === Protocol::OSTATUS) {
60 ActivityPub\Receiver::switchContact($contact['id'], $importer_uid, $contact['url']);
61 $contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
64 // These three networks can be able to speak AP, so we are trying to fetch AP profile data here
65 if (in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DIASPORA, Protocol::DFRN])) {
66 APContact::getByURL($contact['url']);
69 // We currently don't do anything more with AP here
70 if ($contact['network'] === Protocol::ACTIVITYPUB) {
74 // load current friends if possible.
75 if (($contact['poco'] != "") && ($contact['success_update'] > $contact['failure_update'])) {
76 $r = q("SELECT count(*) AS total FROM glink
77 WHERE `cid` = %d AND updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
78 intval($contact['id'])
80 if (DBA::isResult($r)) {
81 if (!$r[0]['total']) {
82 PortableContact::loadWorker($contact['id'], $importer_uid, 0, $contact['poco']);
87 // Diaspora users, archived users and followers are only checked if they still exist.
88 if ($contact['archive'] || ($contact["network"] == Protocol::DIASPORA) || ($contact["rel"] == Contact::FOLLOWER)) {
89 $last_updated = PortableContact::lastUpdated($contact["url"], true);
90 $updated = DateTimeFormat::utcNow();
93 Logger::log('Contact '.$contact['id'].' had last update on '.$last_updated, Logger::DEBUG);
95 // The last public item can be older than the last item we got
96 if ($last_updated < $contact['last-item']) {
97 $last_updated = $contact['last-item'];
100 $fields = ['last-item' => DateTimeFormat::utc($last_updated), 'last-update' => $updated, 'success_update' => $updated];
101 self::updateContact($contact, $fields);
102 Contact::unmarkForArchival($contact);
104 self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]);
105 Contact::markForArchival($contact);
106 Logger::log('Contact '.$contact['id'].' is marked for archival', Logger::DEBUG);
114 $t = $contact['last-update'];
116 if ($contact['subhub']) {
117 $poll_interval = Config::get('system', 'pushpoll_frequency', 3);
118 $contact['priority'] = intval($poll_interval);
121 if (DateTimeFormat::utcNow() > DateTimeFormat::utc($t . " + 1 day")) {
128 $last_update = (($contact['last-update'] <= DBA::NULL_DATETIME)
129 ? DateTimeFormat::utc('now - 7 days', DateTimeFormat::ATOM)
130 : DateTimeFormat::utc($contact['last-update'], DateTimeFormat::ATOM)
133 // Update the contact entry
134 if (($contact['network'] === Protocol::OSTATUS) || ($contact['network'] === Protocol::DIASPORA) || ($contact['network'] === Protocol::DFRN)) {
135 if (!PortableContact::reachable($contact['url'])) {
136 Logger::log("Skipping probably dead contact ".$contact['url']);
138 // set the last-update so we don't keep polling
139 DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
143 if (!Contact::updateFromProbe($contact["id"])) {
144 Contact::markForArchival($contact);
145 Logger::log('Contact is marked dead');
147 // set the last-update so we don't keep polling
148 DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
151 Contact::unmarkForArchival($contact);
155 if (!in_array($contact['network'], [Protocol::FEED, Protocol::MAIL]) && Config::get('system', 'disable_polling')) {
159 if ($importer_uid == 0) {
160 Logger::log('Ignore public contacts');
162 // set the last-update so we don't keep polling
163 DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
167 $r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` INNER JOIN `user` on `contact`.`uid` = `user`.`uid` WHERE `user`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
168 intval($importer_uid)
171 if (!DBA::isResult($r)) {
172 Logger::log('No self contact for user '.$importer_uid);
174 // set the last-update so we don't keep polling
175 DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
182 Logger::log("poll: ({$contact['network']}-{$contact['id']}) IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}");
184 if ($contact['network'] === Protocol::DFRN) {
185 $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
186 if (intval($contact['duplex']) && $contact['dfrn-id']) {
187 $idtosend = '0:' . $orig_id;
189 if (intval($contact['duplex']) && $contact['issued-id']) {
190 $idtosend = '1:' . $orig_id;
193 // they have permission to write to us. We already filtered this in the contact query.
196 // But this may be our first communication, so set the writable flag if it isn't set already.
198 if (!intval($contact['writable'])) {
199 $fields = ['writable' => true];
200 DBA::update('contact', $fields, ['id' => $contact['id']]);
203 $url = $contact['poll'] . '?dfrn_id=' . $idtosend
204 . '&dfrn_version=' . DFRN_PROTOCOL_VERSION
205 . '&type=data&last_update=' . $last_update
208 $curlResult = Network::curl($url);
210 if (!$curlResult->isSuccess() && ($curlResult->getErrorNumber() == CURLE_OPERATION_TIMEDOUT)) {
211 // set the last-update so we don't keep polling
212 DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
213 Contact::markForArchival($contact);
217 $handshake_xml = $curlResult->getBody();
218 $html_code = $curlResult->getReturnCode();
220 Logger::log('handshake with url ' . $url . ' returns xml: ' . $handshake_xml, Logger::DATA);
222 if (!strlen($handshake_xml) || ($html_code >= 400) || !$html_code) {
223 Logger::log("$url appears to be dead - marking for death ");
225 // dead connection - might be a transient event, or this might
226 // mean the software was uninstalled or the domain expired.
227 // Will keep trying for one month.
229 Contact::markForArchival($contact);
231 // set the last-update so we don't keep polling
232 $fields = ['last-update' => DateTimeFormat::utcNow(), 'failure_update' => DateTimeFormat::utcNow()];
233 self::updateContact($contact, $fields);
237 if (!strstr($handshake_xml, '<')) {
238 Logger::log('response from ' . $url . ' did not contain XML.');
240 Contact::markForArchival($contact);
242 $fields = ['last-update' => DateTimeFormat::utcNow(), 'failure_update' => DateTimeFormat::utcNow()];
243 self::updateContact($contact, $fields);
248 $res = XML::parseString($handshake_xml);
250 if (intval($res->status) == 1) {
251 Logger::log("$url replied status 1 - marking for death ");
253 // we may not be friends anymore. Will keep trying for one month.
254 // set the last-update so we don't keep polling
255 $fields = ['last-update' => DateTimeFormat::utcNow(), 'failure_update' => DateTimeFormat::utcNow()];
256 self::updateContact($contact, $fields);
258 Contact::markForArchival($contact);
259 } elseif ($contact['term-date'] > DBA::NULL_DATETIME) {
260 Logger::log("$url back from the dead - removing mark for death");
261 Contact::unmarkForArchival($contact);
264 if ((intval($res->status) != 0) || !strlen($res->challenge) || !strlen($res->dfrn_id)) {
265 // set the last-update so we don't keep polling
266 DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
270 if (((float)$res->dfrn_version > 2.21) && ($contact['poco'] == '')) {
271 $fields = ['poco' => str_replace('/profile/', '/poco/', $contact['url'])];
272 DBA::update('contact', $fields, ['id' => $contact['id']]);
277 $sent_dfrn_id = hex2bin((string) $res->dfrn_id);
278 $challenge = hex2bin((string) $res->challenge);
282 if ($contact['duplex'] && strlen($contact['prvkey'])) {
283 openssl_private_decrypt($sent_dfrn_id, $final_dfrn_id, $contact['prvkey']);
284 openssl_private_decrypt($challenge, $postvars['challenge'], $contact['prvkey']);
286 openssl_public_decrypt($sent_dfrn_id, $final_dfrn_id, $contact['pubkey']);
287 openssl_public_decrypt($challenge, $postvars['challenge'], $contact['pubkey']);
290 $final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.'));
292 if (strpos($final_dfrn_id, ':') == 1) {
293 $final_dfrn_id = substr($final_dfrn_id, 2);
296 if ($final_dfrn_id != $orig_id) {
297 // did not decode properly - cannot trust this site
298 Logger::log('ID did not decode: ' . $contact['id'] . ' orig: ' . $orig_id . ' final: ' . $final_dfrn_id);
300 // set the last-update so we don't keep polling
301 DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
302 Contact::markForArchival($contact);
306 $postvars['dfrn_id'] = $idtosend;
307 $postvars['dfrn_version'] = DFRN_PROTOCOL_VERSION;
308 $postvars['perm'] = 'rw';
310 $xml = Network::post($contact['poll'], $postvars)->getBody();
312 } elseif (($contact['network'] === Protocol::OSTATUS)
313 || ($contact['network'] === Protocol::DIASPORA)
314 || ($contact['network'] === Protocol::FEED)) {
316 // Upgrading DB fields from an older Friendica version
317 // Will only do this once per notify-enabled OStatus contact
318 // or if relationship changes
320 $stat_writeable = ((($contact['notify']) && ($contact['rel'] == Contact::FOLLOWER || $contact['rel'] == Contact::FRIEND)) ? 1 : 0);
322 // Contacts from OStatus are always writable
323 if ($contact['network'] === Protocol::OSTATUS) {
327 if ($stat_writeable != $contact['writable']) {
328 $fields = ['writable' => $stat_writeable];
329 DBA::update('contact', $fields, ['id' => $contact['id']]);
332 // Are we allowed to import from this person?
334 if ($contact['rel'] == Contact::FOLLOWER || $contact['blocked']) {
335 // set the last-update so we don't keep polling
336 DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
340 $cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-');
341 $curlResult = Network::curl($contact['poll'], false, $redirects, ['cookiejar' => $cookiejar]);
344 if ($curlResult->isTimeout()) {
345 // set the last-update so we don't keep polling
346 DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
347 Contact::markForArchival($contact);
351 $xml = $curlResult->getBody();
353 } elseif ($contact['network'] === Protocol::MAIL) {
354 Logger::log("Mail: Fetching for ".$contact['addr'], Logger::DEBUG);
356 $mail_disabled = ((function_exists('imap_open') && !Config::get('system', 'imap_disabled')) ? 0 : 1);
357 if ($mail_disabled) {
358 // set the last-update so we don't keep polling
359 DBA::update('contact', ['last-update' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
360 Contact::markForArchival($contact);
364 Logger::log("Mail: Enabled", Logger::DEBUG);
367 $user = DBA::selectFirst('user', ['prvkey'], ['uid' => $importer_uid]);
369 $condition = ["`server` != '' AND `uid` = ?", $importer_uid];
370 $mailconf = DBA::selectFirst('mailacct', [], $condition);
371 if (DBA::isResult($user) && DBA::isResult($mailconf)) {
372 $mailbox = Email::constructMailboxName($mailconf);
374 openssl_private_decrypt(hex2bin($mailconf['pass']), $password, $user['prvkey']);
375 $mbox = Email::connect($mailbox, $mailconf['user'], $password);
377 Logger::log("Mail: Connect to " . $mailconf['user']);
379 $fields = ['last_check' => DateTimeFormat::utcNow()];
380 DBA::update('mailacct', $fields, ['id' => $mailconf['id']]);
381 Logger::log("Mail: Connected to " . $mailconf['user']);
383 Logger::log("Mail: Connection error ".$mailconf['user']." ".print_r(imap_errors(), true));
388 $msgs = Email::poll($mbox, $contact['addr']);
391 Logger::log("Mail: Parsing ".count($msgs)." mails from ".$contact['addr']." for ".$mailconf['user'], Logger::DEBUG);
393 $metas = Email::messageMeta($mbox, implode(',', $msgs));
395 if (count($metas) != count($msgs)) {
396 Logger::log("for " . $mailconf['user'] . " there are ". count($msgs) . " messages but received " . count($metas) . " metas", Logger::DEBUG);
398 $msgs = array_combine($msgs, $metas);
400 foreach ($msgs as $msg_uid => $meta) {
401 Logger::log("Mail: Parsing mail ".$msg_uid, Logger::DATA);
404 $datarray['verb'] = ACTIVITY_POST;
405 $datarray['object-type'] = ACTIVITY_OBJ_NOTE;
406 $datarray['network'] = Protocol::MAIL;
407 // $meta = Email::messageMeta($mbox, $msg_uid);
409 $datarray['uri'] = Email::msgid2iri(trim($meta->message_id, '<>'));
411 // Have we seen it before?
412 $fields = ['deleted', 'id'];
413 $condition = ['uid' => $importer_uid, 'uri' => $datarray['uri']];
414 $item = Item::selectFirst($fields, $condition);
415 if (DBA::isResult($item)) {
416 Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],Logger::DEBUG);
418 // Only delete when mails aren't automatically moved or deleted
419 if (($mailconf['action'] != 1) && ($mailconf['action'] != 3))
420 if ($meta->deleted && ! $item['deleted']) {
421 $fields = ['deleted' => true, 'changed' => DateTimeFormat::utcNow()];
422 Item::update($fields, ['id' => $item['id']]);
425 switch ($mailconf['action']) {
427 Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user'].". Doing nothing.", Logger::DEBUG);
430 Logger::log("Mail: Deleting ".$msg_uid." for ".$mailconf['user']);
431 imap_delete($mbox, $msg_uid, FT_UID);
434 Logger::log("Mail: Mark as seen ".$msg_uid." for ".$mailconf['user']);
435 imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
438 Logger::log("Mail: Moving ".$msg_uid." to ".$mailconf['movetofolder']." for ".$mailconf['user']);
439 imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
440 if ($mailconf['movetofolder'] != "") {
441 imap_mail_move($mbox, $msg_uid, $mailconf['movetofolder'], FT_UID);
449 // look for a 'references' or an 'in-reply-to' header and try to match with a parent item we have locally.
450 $raw_refs = ((property_exists($meta, 'references')) ? str_replace("\t", '', $meta->references) : '');
451 if (!trim($raw_refs)) {
452 $raw_refs = ((property_exists($meta, 'in_reply_to')) ? str_replace("\t", '', $meta->in_reply_to) : '');
454 $raw_refs = trim($raw_refs); // Don't allow a blank reference in $refs_arr
457 $refs_arr = explode(' ', $raw_refs);
458 if (count($refs_arr)) {
459 for ($x = 0; $x < count($refs_arr); $x ++) {
460 $refs_arr[$x] = Email::msgid2iri(str_replace(['<', '>', ' '],['', '', ''], $refs_arr[$x]));
463 $condition = ['uri' => $refs_arr, 'uid' => $importer_uid];
464 $parent = Item::selectFirst(['parent-uri'], $condition);
465 if (DBA::isResult($parent)) {
466 $datarray['parent-uri'] = $parent['parent-uri']; // Set the parent as the top-level item
470 // Decoding the header
471 $subject = imap_mime_header_decode($meta->subject);
472 $datarray['title'] = "";
473 foreach ($subject as $subpart) {
474 if ($subpart->charset != "default") {
475 $datarray['title'] .= iconv($subpart->charset, 'UTF-8//IGNORE', $subpart->text);
477 $datarray['title'] .= $subpart->text;
480 $datarray['title'] = Strings::escapeTags(trim($datarray['title']));
482 //$datarray['title'] = Strings::escapeTags(trim($meta->subject));
483 $datarray['created'] = DateTimeFormat::utc($meta->date);
486 $reply = ((substr(strtolower($datarray['title']), 0, 3) == "re:") ||
487 (substr(strtolower($datarray['title']), 0, 3) == "re-") ||
490 // Remove Reply-signs in the subject
491 $datarray['title'] = self::RemoveReply($datarray['title']);
493 // If it seems to be a reply but a header couldn't be found take the last message with matching subject
494 if (empty($datarray['parent-uri']) && $reply) {
495 $condition = ['title' => $datarray['title'], 'uid' => $importer_uid, 'network' => Protocol::MAIL];
496 $params = ['order' => ['created' => true]];
497 $parent = Item::selectFirst(['parent-uri'], $condition, $params);
498 if (DBA::isResult($parent)) {
499 $datarray['parent-uri'] = $parent['parent-uri'];
503 if (empty($datarray['parent-uri'])) {
504 $datarray['parent-uri'] = $datarray['uri'];
507 $r = Email::getMessage($mbox, $msg_uid, $reply);
509 Logger::log("Mail: can't fetch msg ".$msg_uid." for ".$mailconf['user']);
512 $datarray['body'] = Strings::escapeHtml($r['body']);
513 $datarray['body'] = BBCode::limitBodySize($datarray['body']);
515 Logger::log("Mail: Importing ".$msg_uid." for ".$mailconf['user']);
517 /// @TODO Adding a gravatar for the original author would be cool
519 $from = imap_mime_header_decode($meta->from);
521 foreach ($from as $frompart) {
522 if ($frompart->charset != "default") {
523 $fromdecoded .= iconv($frompart->charset, 'UTF-8//IGNORE', $frompart->text);
525 $fromdecoded .= $frompart->text;
529 $fromarr = imap_rfc822_parse_adrlist($fromdecoded, $a->getHostName());
531 $frommail = $fromarr[0]->mailbox."@".$fromarr[0]->host;
533 if (isset($fromarr[0]->personal)) {
534 $fromname = $fromarr[0]->personal;
536 $fromname = $frommail;
539 $datarray['author-name'] = $fromname;
540 $datarray['author-link'] = "mailto:".$frommail;
541 $datarray['author-avatar'] = $contact['photo'];
543 $datarray['owner-name'] = $contact['name'];
544 $datarray['owner-link'] = "mailto:".$contact['addr'];
545 $datarray['owner-avatar'] = $contact['photo'];
547 $datarray['uid'] = $importer_uid;
548 $datarray['contact-id'] = $contact['id'];
549 if ($datarray['parent-uri'] === $datarray['uri']) {
550 $datarray['private'] = 1;
552 if (($contact['network'] === Protocol::MAIL) && !PConfig::get($importer_uid, 'system', 'allow_public_email_replies')) {
553 $datarray['private'] = 1;
554 $datarray['allow_cid'] = '<' . $contact['id'] . '>';
557 $stored_item = Item::insert($datarray);
559 switch ($mailconf['action']) {
561 Logger::log("Mail: Seen before ".$msg_uid." for ".$mailconf['user'].". Doing nothing.", Logger::DEBUG);
564 Logger::log("Mail: Deleting ".$msg_uid." for ".$mailconf['user']);
565 imap_delete($mbox, $msg_uid, FT_UID);
568 Logger::log("Mail: Mark as seen ".$msg_uid." for ".$mailconf['user']);
569 imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
572 Logger::log("Mail: Moving ".$msg_uid." to ".$mailconf['movetofolder']." for ".$mailconf['user']);
573 imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
574 if ($mailconf['movetofolder'] != "") {
575 imap_mail_move($mbox, $msg_uid, $mailconf['movetofolder'], FT_UID);
582 Logger::log("Mail: no mails for ".$mailconf['user']);
585 Logger::log("Mail: closing connection for ".$mailconf['user']);
591 Logger::log('received xml : ' . $xml, Logger::DATA);
592 if (!strstr($xml, '<')) {
593 Logger::log('post_handshake: response from ' . $url . ' did not contain XML.');
595 $fields = ['last-update' => DateTimeFormat::utcNow(), 'failure_update' => DateTimeFormat::utcNow()];
596 self::updateContact($contact, $fields);
597 Contact::markForArchival($contact);
602 Logger::log("Consume feed of contact ".$contact['id']);
604 consume_feed($xml, $importer, $contact, $hub);
606 // do it a second time for DFRN so that any children find their parents.
607 if ($contact['network'] === Protocol::DFRN) {
608 consume_feed($xml, $importer, $contact, $hub);
611 $hubmode = 'subscribe';
612 if ($contact['network'] === Protocol::DFRN || $contact['blocked']) {
613 $hubmode = 'unsubscribe';
616 if (($contact['network'] === Protocol::OSTATUS || $contact['network'] == Protocol::FEED) && (! $contact['hub-verify'])) {
624 Logger::log("Contact ".$contact['id']." returned hub: ".$hub." Network: ".$contact['network']." Relation: ".$contact['rel']." Update: ".$hub_update);
626 if (strlen($hub) && $hub_update && (($contact['rel'] != Contact::FOLLOWER) || $contact['network'] == Protocol::FEED)) {
627 Logger::log('hub ' . $hubmode . ' : ' . $hub . ' contact name : ' . $contact['name'] . ' local user : ' . $importer['name']);
628 $hubs = explode(',', $hub);
631 foreach ($hubs as $h) {
638 subscribe_to_hub($h, $importer, $contact, $hubmode);
643 $updated = DateTimeFormat::utcNow();
645 self::updateContact($contact, ['last-update' => $updated, 'success_update' => $updated]);
646 DBA::update('gcontact', ['last_contact' => $updated], ['nurl' => $contact['nurl']]);
647 Contact::unmarkForArchival($contact);
648 } elseif (in_array($contact["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, Protocol::FEED])) {
649 $updated = DateTimeFormat::utcNow();
651 self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]);
652 DBA::update('gcontact', ['last_failure' => $updated], ['nurl' => $contact['nurl']]);
653 Contact::markForArchival($contact);
655 $updated = DateTimeFormat::utcNow();
656 DBA::update('contact', ['last-update' => $updated], ['id' => $contact['id']]);
662 private static function RemoveReply($subject)
664 while (in_array(strtolower(substr($subject, 0, 3)), ["re:", "aw:"])) {
665 $subject = trim(substr($subject, 4));
672 * @brief Updates a personal contact entry and the public contact entry
674 * @param array $contact The personal contact entry
675 * @param array $fields The fields that are updated
677 private static function updateContact(array $contact, array $fields)
679 DBA::update('contact', $fields, ['id' => $contact['id']]);
680 DBA::update('contact', $fields, ['uid' => 0, 'nurl' => $contact['nurl']]);