]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/FetchMissingActivity.php
Issue 11513: Non public replies on public posts should now work
[friendica.git] / src / Worker / FetchMissingActivity.php
index 116f098db02e9519bbef8e7a1c5831efb68fb9c2..d48d834c672e1a4b8871420465d6744fc07ba539 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -23,6 +23,7 @@ namespace Friendica\Worker;
 
 use Friendica\Core\Logger;
 use Friendica\Core\Worker;
+use Friendica\DI;
 use Friendica\Protocol\ActivityPub;
 use Friendica\Protocol\ActivityPub\Queue;
 use Friendica\Protocol\ActivityPub\Receiver;
@@ -32,6 +33,8 @@ class FetchMissingActivity
        /**
         * Fetch missing activities
         * @param string $url Contact URL
+        *
+        * @return void
         */
        public static function execute(string $url, array $child = [], string $relay_actor = '', int $completion = Receiver::COMPLETION_MANUAL)
        {
@@ -39,10 +42,14 @@ class FetchMissingActivity
                $result = ActivityPub\Processor::fetchMissingActivity($url, $child, $relay_actor, $completion);
                if ($result) {
                        Logger::info('Successfully fetched missing activity', ['url' => $url]);
-                       Queue::processReplyByUri($url);
                } elseif (!Worker::defer()) {
                        Logger::info('Activity could not be fetched', ['url' => $url]);
-                       // Possibly we should recursively remove child activities at this point.
+
+                       // recursively delete all entries that belong to this worker task
+                       $queue = DI::app()->getQueue();
+                       if (!empty($queue['id'])) {
+                               Queue::deleteByWorkerId($queue['id']);
+                       }
                } else {
                        Logger::info('Fetching deferred', ['url' => $url]);
                }