X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FWorker%2FProfileUpdate.php;h=23fb6d27c16b6f02c32e68a586d1a20591296328;hb=97456ff20542b2dffabae77a2bab6428c51ac218;hp=e33aa5d9a88ad6a2804d044f5242da1f8cbc4771;hpb=a21f6135fcd8f0bfdb49de38a5ab4954d1784503;p=friendica.git diff --git a/src/Worker/ProfileUpdate.php b/src/Worker/ProfileUpdate.php index e33aa5d9a8..23fb6d27c1 100644 --- a/src/Worker/ProfileUpdate.php +++ b/src/Worker/ProfileUpdate.php @@ -1,19 +1,65 @@ . + * */ namespace Friendica\Worker; +use Friendica\Core\Logger; +use Friendica\Core\Worker; +use Friendica\DI; +use Friendica\Protocol\Delivery; use Friendica\Protocol\Diaspora; +use Friendica\Protocol\ActivityPub; +/** + * Send updated profile data to Diaspora and ActivityPub + */ class ProfileUpdate { - public static function execute($uid = 0) { + /** + * Sends updated profile data to Diaspora and ActivityPub + * + * @param int $uid User id (optional, default: 0) + * @return void + */ + public static function execute(int $uid = 0) + { if (empty($uid)) { return; } + $a = DI::app(); + + $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid); + + foreach ($inboxes as $inbox => $receivers) { + Logger::info('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub'); + Worker::add(['priority' => $a->getQueueValue('priority'), 'created' => $a->getQueueValue('created'), 'dont_fork' => true], + 'APDelivery', + Delivery::PROFILEUPDATE, + 0, + $inbox, + $uid, + $receivers + ); + } + Diaspora::sendProfile($uid); } }