diff options
author | Vincent Petry <vincent@nextcloud.com> | 2021-08-05 10:42:38 +0200 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2021-08-12 13:58:07 +0200 |
commit | 78ea6d0679acfc3908bf97b41e7d9cdcc7076e7b (patch) | |
tree | 1c37a36f8cb119d560da72c1d10ea296b6642cd8 /apps/workflowengine/lib/Controller | |
parent | 514ba5f419b39740e6525a35d0eb3dd1ba989d24 (diff) | |
download | nextcloud-server-78ea6d0679acfc3908bf97b41e7d9cdcc7076e7b.tar.gz nextcloud-server-78ea6d0679acfc3908bf97b41e7d9cdcc7076e7b.zip |
Make "name" column nullable in workflow operations
The "name" column is now unused and the code is always inserting an
empty string. While this works with most databases, Oracle complains
because an empty string is equivalent to null.
To fix this, the column definition is changed to allow null values now.
Also added some logging in case of database exceptions, because without
this nothing would be logged to detect the above problem.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps/workflowengine/lib/Controller')
-rw-r--r-- | apps/workflowengine/lib/Controller/AWorkflowController.php | 11 | ||||
-rw-r--r-- | apps/workflowengine/lib/Controller/UserWorkflowsController.php | 6 |
2 files changed, 14 insertions, 3 deletions
diff --git a/apps/workflowengine/lib/Controller/AWorkflowController.php b/apps/workflowengine/lib/Controller/AWorkflowController.php index 8b0d35ef62e..20e4f74d3c4 100644 --- a/apps/workflowengine/lib/Controller/AWorkflowController.php +++ b/apps/workflowengine/lib/Controller/AWorkflowController.php @@ -34,20 +34,26 @@ use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCS\OCSForbiddenException; use OCP\AppFramework\OCSController; use OCP\IRequest; +use Psr\Log\LoggerInterface; abstract class AWorkflowController extends OCSController { /** @var Manager */ protected $manager; + /** @var LoggerInterface */ + private $logger; + public function __construct( $appName, IRequest $request, - Manager $manager + Manager $manager, + LoggerInterface $logger ) { parent::__construct($appName, $request); $this->manager = $manager; + $this->logger = $logger; } /** @@ -113,6 +119,7 @@ abstract class AWorkflowController extends OCSController { } catch (\DomainException $e) { throw new OCSForbiddenException($e->getMessage(), $e); } catch (Exception $e) { + $this->logger->error('Error when inserting flow', ['exception' => $e]); throw new OCSException('An internal error occurred', $e->getCode(), $e); } } @@ -140,6 +147,7 @@ abstract class AWorkflowController extends OCSController { } catch (\DomainException $e) { throw new OCSForbiddenException($e->getMessage(), $e); } catch (Exception $e) { + $this->logger->error('Error when updating flow with id ' . $id, ['exception' => $e]); throw new OCSException('An internal error occurred', $e->getCode(), $e); } } @@ -158,6 +166,7 @@ abstract class AWorkflowController extends OCSController { } catch (\DomainException $e) { throw new OCSForbiddenException($e->getMessage(), $e); } catch (Exception $e) { + $this->logger->error('Error when deleting flow with id ' . $id, ['exception' => $e]); throw new OCSException('An internal error occurred', $e->getCode(), $e); } } diff --git a/apps/workflowengine/lib/Controller/UserWorkflowsController.php b/apps/workflowengine/lib/Controller/UserWorkflowsController.php index c3884b61979..ce1ce05af9b 100644 --- a/apps/workflowengine/lib/Controller/UserWorkflowsController.php +++ b/apps/workflowengine/lib/Controller/UserWorkflowsController.php @@ -33,6 +33,7 @@ use OCP\AppFramework\OCS\OCSForbiddenException; use OCP\IRequest; use OCP\IUserSession; use OCP\WorkflowEngine\IManager; +use Psr\Log\LoggerInterface; class UserWorkflowsController extends AWorkflowController { @@ -46,9 +47,10 @@ class UserWorkflowsController extends AWorkflowController { $appName, IRequest $request, Manager $manager, - IUserSession $session + IUserSession $session, + LoggerInterface $logger ) { - parent::__construct($appName, $request, $manager); + parent::__construct($appName, $request, $manager, $logger); $this->session = $session; } |