]> git.mxchange.org Git - friendica.git/blob - src/Worker/UpdateContact.php
New contact field "updated", fix warnings
[friendica.git] / src / Worker / UpdateContact.php
1 <?php
2
3 /**
4  * @file src/Worker/UpdateContact.php
5  */
6
7 namespace Friendica\Worker;
8
9 use Friendica\Core\Logger;
10 use Friendica\Model\Contact;
11 use Friendica\Util\DateTimeFormat;
12 use Friendica\Database\DBA;
13
14 class UpdateContact
15 {
16         public static function execute($contact_id)
17         {
18                 $success = Contact::updateFromProbe($contact_id);
19                 // Update the "updated" field if the contact could be probed.
20                 // We don't do this in the function above, since we don't want to
21                 // update the contact whenever that function is called from anywhere.
22                 if ($success) {
23                         DBA::update('contact', ['updated' => DateTimeFormat::utcNow()], ['id' => $contact_id]);
24                 }
25
26                 Logger::info('Updated from probe', ['id' => $contact_id, 'success' => $success]);
27         }
28 }