]> git.mxchange.org Git - friendica.git/blob - src/Worker/ProfileUpdate.php
b5ae51bd4b883fe239bf9d7d75d3053fcd14503c
[friendica.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\DI;
13 use Friendica\Protocol\Diaspora;
14 use Friendica\Protocol\ActivityPub;
15
16 class ProfileUpdate {
17         public static function execute($uid = 0) {
18                 if (empty($uid)) {
19                         return;
20                 }
21
22                 $a = DI::app();
23
24                 $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid);
25
26                 foreach ($inboxes as $inbox) {
27                         Logger::log('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub', Logger::DEBUG);
28                         Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
29                                 'APDelivery', Delivery::PROFILEUPDATE, '', $inbox, $uid);
30                 }
31
32                 Diaspora::sendProfile($uid);
33         }
34 }