aboutsummaryrefslogtreecommitdiffstats
path: root/core/Controller/TaskProcessingApiController.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/Controller/TaskProcessingApiController.php')
-rw-r--r--core/Controller/TaskProcessingApiController.php42
1 files changed, 1 insertions, 41 deletions
diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php
index 90a0e9ba14a..82b4d786914 100644
--- a/core/Controller/TaskProcessingApiController.php
+++ b/core/Controller/TaskProcessingApiController.php
@@ -31,7 +31,6 @@ use OCP\Files\NotPermittedException;
use OCP\IL10N;
use OCP\IRequest;
use OCP\Lock\LockedException;
-use OCP\TaskProcessing\EShapeType;
use OCP\TaskProcessing\Exception\Exception;
use OCP\TaskProcessing\Exception\NotFoundException;
use OCP\TaskProcessing\Exception\PreConditionNotMetException;
@@ -391,7 +390,7 @@ class TaskProcessingApiController extends OCSController {
* @return StreamResponse<Http::STATUS_OK, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}>
*/
private function getFileContentsInternal(Task $task, int $fileId): StreamResponse|DataResponse {
- $ids = $this->extractFileIdsFromTask($task);
+ $ids = $this->taskProcessingManager->extractFileIdsFromTask($task);
if (!in_array($fileId, $ids)) {
return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND);
}
@@ -429,45 +428,6 @@ class TaskProcessingApiController extends OCSController {
}
/**
- * @param Task $task
- * @return list<int>
- * @throws NotFoundException
- */
- private function extractFileIdsFromTask(Task $task): array {
- $ids = [];
- $taskTypes = $this->taskProcessingManager->getAvailableTaskTypes();
- if (!isset($taskTypes[$task->getTaskTypeId()])) {
- throw new NotFoundException('Could not find task type');
- }
- $taskType = $taskTypes[$task->getTaskTypeId()];
- foreach ($taskType['inputShape'] + $taskType['optionalInputShape'] as $key => $descriptor) {
- if (in_array(EShapeType::getScalarType($descriptor->getShapeType()), [EShapeType::File, EShapeType::Image, EShapeType::Audio, EShapeType::Video], true)) {
- /** @var int|list<int> $inputSlot */
- $inputSlot = $task->getInput()[$key];
- if (is_array($inputSlot)) {
- $ids = array_merge($inputSlot, $ids);
- } else {
- $ids[] = $inputSlot;
- }
- }
- }
- if ($task->getOutput() !== null) {
- foreach ($taskType['outputShape'] + $taskType['optionalOutputShape'] as $key => $descriptor) {
- if (in_array(EShapeType::getScalarType($descriptor->getShapeType()), [EShapeType::File, EShapeType::Image, EShapeType::Audio, EShapeType::Video], true)) {
- /** @var int|list<int> $outputSlot */
- $outputSlot = $task->getOutput()[$key];
- if (is_array($outputSlot)) {
- $ids = array_merge($outputSlot, $ids);
- } else {
- $ids[] = $outputSlot;
- }
- }
- }
- }
- return $ids;
- }
-
- /**
* Sets the task progress
*
* @param int $taskId The id of the task