summaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/workflowengine/lib')
-rw-r--r--apps/workflowengine/lib/Controller/AWorkflowController.php11
-rw-r--r--apps/workflowengine/lib/Controller/UserWorkflowsController.php6
-rw-r--r--apps/workflowengine/lib/Migration/Version2000Date20190808074233.php2
-rw-r--r--apps/workflowengine/lib/Migration/Version2200Date20210805101925.php54
4 files changed, 69 insertions, 4 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;
}
diff --git a/apps/workflowengine/lib/Migration/Version2000Date20190808074233.php b/apps/workflowengine/lib/Migration/Version2000Date20190808074233.php
index e8ce704f9bd..422e839ae89 100644
--- a/apps/workflowengine/lib/Migration/Version2000Date20190808074233.php
+++ b/apps/workflowengine/lib/Migration/Version2000Date20190808074233.php
@@ -66,7 +66,7 @@ class Version2000Date20190808074233 extends SimpleMigrationStep {
'default' => '',
]);
$table->addColumn('name', Types::STRING, [
- 'notnull' => true,
+ 'notnull' => false,
'length' => 256,
'default' => '',
]);
diff --git a/apps/workflowengine/lib/Migration/Version2200Date20210805101925.php b/apps/workflowengine/lib/Migration/Version2200Date20210805101925.php
new file mode 100644
index 00000000000..9f2049dc611
--- /dev/null
+++ b/apps/workflowengine/lib/Migration/Version2200Date20210805101925.php
@@ -0,0 +1,54 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2021 Vincent Petry <vincent@nextcloud.com>
+ *
+ * @author Vincent Petry <vincent@nextcloud.com>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+namespace OCA\WorkflowEngine\Migration;
+
+use Closure;
+use OCP\DB\ISchemaWrapper;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+class Version2200Date20210805101925 extends SimpleMigrationStep {
+
+ /**
+ * @param IOutput $output
+ * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
+ * @param array $options
+ * @return null|ISchemaWrapper
+ */
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+
+ if ($schema->hasTable('flow_operations')) {
+ $table = $schema->getTable('flow_operations');
+ $table->changeColumn('name', [
+ 'notnull' => false,
+ ]);
+ }
+
+ return $schema;
+ }
+}