Use Model\Photo as much as possible
[friendica.git/.git] / src / Worker / ProfileUpdate.php
1 <?php
2 /**
3  * @file src/Worker/ProfileUpdate.php
4  * @brief Send updated profile data to Diaspora and ActivityPub
5  */
6
7 namespace Friendica\Worker;
8
9 use Friendica\BaseObject;
10 use Friendica\Core\Logger;
11 use Friendica\Core\Worker;
12 use Friendica\Protocol\Diaspora;
13 use Friendica\Protocol\ActivityPub;
14
15 class ProfileUpdate {
16         public static function execute($uid = 0) {
17                 if (empty($uid)) {
18                         return;
19                 }
20
21                 $a = BaseObject::getApp();
22
23                 $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid);
24
25                 foreach ($inboxes as $inbox) {
26                         Logger::log('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub', Logger::DEBUG);
27                         Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
28                                 'APDelivery', Delivery::PROFILEUPDATE, '', $inbox, $uid);
29                 }
30
31                 Diaspora::sendProfile($uid);
32         }
33 }