From f3a47ca62eb7ecb2d785afb47a13c5fbe0e88b91 Mon Sep 17 00:00:00 2001 From: Andrey Borysenko Date: Wed, 17 Apr 2024 14:52:17 +0300 Subject: [PATCH] WIP: minor adjustments Signed-off-by: Andrey Borysenko --- docs/tech_details/api/occ_command.rst | 4 ++++ lib/Service/ExAppOccService.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/tech_details/api/occ_command.rst b/docs/tech_details/api/occ_command.rst index a43863b7..8e0254c1 100644 --- a/docs/tech_details/api/occ_command.rst +++ b/docs/tech_details/api/occ_command.rst @@ -9,6 +9,10 @@ The principal is similar to the regular Nextcloud OCC command for PHP apps, that but for ExApps it is a trigger via Nextcloud OCC interface to perform some action on the External App side. +.. note:: + + Passing files directly as an input argument to the occ command is not supported. + Register ^^^^^^^^ diff --git a/lib/Service/ExAppOccService.php b/lib/Service/ExAppOccService.php index 2bc7c431..a691a252 100644 --- a/lib/Service/ExAppOccService.php +++ b/lib/Service/ExAppOccService.php @@ -152,19 +152,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int foreach ($this->occCommand->getArguments() as $argument) { $arguments[$argument['name']] = $input->getArgument($argument['name']); } - $options = []; foreach ($this->occCommand->getOptions() as $option) { $options[$option['name']] = $input->getOption($option['name']); } $executeHandler = $this->occCommand->getExecuteHandler(); - $response = $this->service->exAppRequest($this->occCommand->getAppid(), $executeHandler, null, 'POST', [], [ + $response = $this->service->exAppRequest($this->occCommand->getAppid(), $executeHandler, params: [ 'occ' => [ 'arguments' => $arguments, 'options' => $options, ] ]); + if (!($response instanceof IResponse) && isset($response['error'])) { $output->writeln(sprintf('[%s] command executeHandler failed. Error: %s', $this->occCommand->getName(), $response['error'])); $this->logger->error(sprintf('[%s] command executeHandler failed. Error: %s', $this->occCommand->getName(), $response['error']), [