Create ActivityPub\FetchQueue and ActivityPub\FetchQueueItem classes

- These classes are used to flatten the recursive missing activity fetch that can hit PHP's maximum function nesting limit
- The original caller is responsible for processing the remaining queue once the original activity has been fetched
This commit is contained in:
Hypolite Petovan 2022-06-24 23:48:49 -04:00
parent 3c70d592f6
commit da32fa8fa6
7 changed files with 189 additions and 42 deletions

View file

@ -3411,7 +3411,11 @@ class Item
return is_numeric($hookData['item_id']) ? $hookData['item_id'] : 0;
}
if ($fetched_uri = ActivityPub\Processor::fetchMissingActivity($uri)) {
$fetchQueue = new ActivityPub\FetchQueue();
$fetched_uri = ActivityPub\Processor::fetchMissingActivity($fetchQueue, $uri);
$fetchQueue->process();
if ($fetched_uri) {
$item_id = self::searchByLink($fetched_uri, $uid);
} else {
$item_id = Diaspora::fetchByURL($uri);