diff options
author | Jana Peper <jana.peper@nextcloud.com> | 2024-12-11 17:29:45 +0100 |
---|---|---|
committer | janepie <49834966+janepie@users.noreply.github.com> | 2024-12-18 18:32:34 +0100 |
commit | 40fc07b54384125c1dcaff82f2cb18d418b15441 (patch) | |
tree | f7bcfd64399bc1f1e871e31a9ca5ea2bec472f2a /lib | |
parent | 3857decfcbcd5961d9cccbca402665adde836fe2 (diff) | |
download | nextcloud-server-40fc07b54384125c1dcaff82f2cb18d418b15441.tar.gz nextcloud-server-40fc07b54384125c1dcaff82f2cb18d418b15441.zip |
fix: always regenerate availabe task types
Signed-off-by: Jana Peper <jana.peper@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/TaskProcessing/Manager.php | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index c02a0665760..2a7bcfab8b8 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -733,43 +733,42 @@ class Manager implements IManager { } public function getAvailableTaskTypes(bool $showDisabled = false): array { - if ($this->availableTaskTypes === null) { - $taskTypes = $this->_getTaskTypes(); - $taskTypeSettings = $this->_getTaskTypeSettings(); + $taskTypes = $this->_getTaskTypes(); + $taskTypeSettings = $this->_getTaskTypeSettings(); - $availableTaskTypes = []; - foreach ($taskTypes as $taskType) { - if ((!$showDisabled) && isset($taskTypeSettings[$taskType->getId()]) && !$taskTypeSettings[$taskType->getId()]) { - continue; - } - try { - $provider = $this->getPreferredProvider($taskType->getId()); - } catch (\OCP\TaskProcessing\Exception\Exception $e) { - continue; - } - try { - $availableTaskTypes[$provider->getTaskTypeId()] = [ - 'name' => $taskType->getName(), - 'description' => $taskType->getDescription(), - 'optionalInputShape' => $provider->getOptionalInputShape(), - 'inputShapeEnumValues' => $provider->getInputShapeEnumValues(), - 'inputShapeDefaults' => $provider->getInputShapeDefaults(), - 'inputShape' => $taskType->getInputShape(), - 'optionalInputShapeEnumValues' => $provider->getOptionalInputShapeEnumValues(), - 'optionalInputShapeDefaults' => $provider->getOptionalInputShapeDefaults(), - 'outputShape' => $taskType->getOutputShape(), - 'outputShapeEnumValues' => $provider->getOutputShapeEnumValues(), - 'optionalOutputShape' => $provider->getOptionalOutputShape(), - 'optionalOutputShapeEnumValues' => $provider->getOptionalOutputShapeEnumValues(), - ]; - } catch (\Throwable $e) { - $this->logger->error('Failed to set up TaskProcessing provider ' . $provider::class, ['exception' => $e]); - } + $availableTaskTypes = []; + foreach ($taskTypes as $taskType) { + if ((!$showDisabled) && isset($taskTypeSettings[$taskType->getId()]) && !$taskTypeSettings[$taskType->getId()]) { + continue; + } + try { + $provider = $this->getPreferredProvider($taskType->getId()); + } catch (\OCP\TaskProcessing\Exception\Exception $e) { + continue; + } + try { + $availableTaskTypes[$provider->getTaskTypeId()] = [ + 'name' => $taskType->getName(), + 'description' => $taskType->getDescription(), + 'optionalInputShape' => $provider->getOptionalInputShape(), + 'inputShapeEnumValues' => $provider->getInputShapeEnumValues(), + 'inputShapeDefaults' => $provider->getInputShapeDefaults(), + 'inputShape' => $taskType->getInputShape(), + 'optionalInputShapeEnumValues' => $provider->getOptionalInputShapeEnumValues(), + 'optionalInputShapeDefaults' => $provider->getOptionalInputShapeDefaults(), + 'outputShape' => $taskType->getOutputShape(), + 'outputShapeEnumValues' => $provider->getOutputShapeEnumValues(), + 'optionalOutputShape' => $provider->getOptionalOutputShape(), + 'optionalOutputShapeEnumValues' => $provider->getOptionalOutputShapeEnumValues(), + ]; + } catch (\Throwable $e) { + $this->logger->error('Failed to set up TaskProcessing provider ' . $provider::class, ['exception' => $e]); } - - $this->availableTaskTypes = $availableTaskTypes; } + $this->availableTaskTypes = $availableTaskTypes; + + return $this->availableTaskTypes; } |