From: Michael Date: Sun, 15 May 2022 09:08:35 +0000 (+0000) Subject: Fetch featured posts through a worker X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=30b9af10aceb117bf3ea6ba7b049412e71094906;p=friendica.git Fetch featured posts through a worker --- diff --git a/src/Model/Contact.php b/src/Model/Contact.php index c666fed7bf..d0febc8bba 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -2316,7 +2316,10 @@ class Contact if ($uid == 0) { if ($ret['network'] == Protocol::ACTIVITYPUB) { - ActivityPub\Processor::fetchFeaturedPosts($ret['url']); + $apcontact = APContact::getByURL($ret['url'], false); + if (!empty($apcontact['featured'])) { + Worker::add(PRIORITY_LOW, 'FetchFeaturedPosts', $ret['url']); + } } $ret['last-item'] = Probe::getLastUpdate($ret); diff --git a/src/Worker/FetchFeaturedPosts.php b/src/Worker/FetchFeaturedPosts.php new file mode 100644 index 0000000000..757cc9c460 --- /dev/null +++ b/src/Worker/FetchFeaturedPosts.php @@ -0,0 +1,39 @@ +. + * + */ + +namespace Friendica\Worker; + +use Friendica\Core\Logger; +use Friendica\Protocol\ActivityPub; + +class FetchFeaturedPosts +{ + /** + * Fetch featured posts from a contact with the given URL + * @param string $url Contact URL + */ + public static function execute(string $url) + { + Logger::info('Start fetching featured posts', ['url' => $url]); + ActivityPub\Processor::fetchFeaturedPosts($url); + Logger::info('Finished fetching featured posts', ['url' => $url]); + } +}