taskService->isTaskTypeRegistered($taskType)) { $taskInformation = $this->taskService->getTaskDetailsFromTaskType($taskType); $className = $taskInformation['className']; try { $taskObject = $this->container->get($className); } catch (ServiceNotFoundException) { $taskObject = GeneralUtility::makeInstance($className); } } else { throw new InvalidTaskException('Task type ' . $taskType . ' not found. Probably not registered?', 1742584362); } if (!$taskObject instanceof AbstractTask) { throw new InvalidTaskException('The deserialized task in not an instance of AbstractTask', 1642954501); } if ($taskObject instanceof ExecuteSchedulableCommandTask) { $taskObject->setTaskType($taskType); } $taskObject->setTaskUid((int)$row['uid']); $taskObject->setTaskGroup((int)$row['task_group']); $taskParameters = json_decode($row['parameters'] ?? '', true) ?: []; // Set additional fields from the row with the parameters stored // in the parameters field for native types. if ($taskInformation['isNativeTask'] ?? false) { // If there are native registered fields, they take precedence over the values. foreach ($taskInformation['additionalFields'] ?? [] as $additionalFieldName) { $taskParameters[$additionalFieldName] = $taskParameters[$additionalFieldName] ?? $row[$additionalFieldName] ?? null; } } $taskObject->setTaskParameters($taskParameters); $taskObject->setDescription((string)$row['description']); $taskObject->setExecutionTime((int)$row['nextexecution']); $taskObject->setTaskGroup((int)$row['task_group']); $taskObject->setDisabled((bool)$row['disable']); $executionDetails = json_decode($row['execution_details'] ?? '', true); if ($executionDetails !== null) { $taskObject->setExecution(Execution::createFromDetails($executionDetails)); } return $taskObject; } throw new InvalidTaskException('No task type given for task ID : ' . $row['uid'], 1740514192); } /** * If the task class couldn't be figured out from the unserialization (because of uninstalled extensions or exceptions), * try to find it in the serialized string with a simple preg match. */ public function extractClassName(string $serializedTask): ?string { if (preg_match('/^O:[0-9]+:"(?P[^"]+)"/', $serializedTask, $matches) === 1) { return $matches['classname']; } return null; } }