aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/lib/Manager.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/workflowengine/lib/Manager.php')
-rw-r--r--apps/workflowengine/lib/Manager.php71
1 files changed, 24 insertions, 47 deletions
diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php
index d232accd900..0f41679789d 100644
--- a/apps/workflowengine/lib/Manager.php
+++ b/apps/workflowengine/lib/Manager.php
@@ -1,31 +1,8 @@
<?php
+
/**
- * @copyright Copyright (c) 2016 Morris Jobke <hey@morrisjobke.de>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author blizzz <blizzz@arthur-schiwon.de>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\WorkflowEngine;
@@ -123,7 +100,7 @@ class Manager implements IManager {
->where($query->expr()->neq('events', $query->createNamedParameter('[]'), IQueryBuilder::PARAM_STR))
->groupBy('class', 'entity', $query->expr()->castColumn('events', IQueryBuilder::PARAM_STR));
- $result = $query->execute();
+ $result = $query->executeQuery();
$operations = [];
while ($row = $result->fetch()) {
$eventNames = \json_decode($row['events']);
@@ -169,13 +146,13 @@ class Manager implements IManager {
->where($query->expr()->eq('o.class', $query->createParameter('operationClass')));
$query->setParameters(['operationClass' => $operationClass]);
- $result = $query->execute();
+ $result = $query->executeQuery();
$scopesByOperation[$operationClass] = [];
while ($row = $result->fetch()) {
$scope = new ScopeContext($row['type'], $row['value']);
- if (!$operation->isAvailableForScope((int) $row['type'])) {
+ if (!$operation->isAvailableForScope((int)$row['type'])) {
continue;
}
@@ -204,7 +181,7 @@ class Manager implements IManager {
}
$query->setParameters(['scope' => $scopeContext->getScope(), 'scopeId' => $scopeContext->getScopeId()]);
- $result = $query->execute();
+ $result = $query->executeQuery();
$this->operations[$scopeContext->getHash()] = [];
while ($row = $result->fetch()) {
@@ -215,7 +192,7 @@ class Manager implements IManager {
continue;
}
- if (!$operation->isAvailableForScope((int) $row['scope_type'])) {
+ if (!$operation->isAvailableForScope((int)$row['scope_type'])) {
continue;
}
@@ -245,7 +222,7 @@ class Manager implements IManager {
$query->select('*')
->from('flow_operations')
->where($query->expr()->eq('id', $query->createNamedParameter($id)));
- $result = $query->execute();
+ $result = $query->executeQuery();
$row = $result->fetch();
$result->closeCursor();
@@ -262,7 +239,7 @@ class Manager implements IManager {
array $checkIds,
string $operation,
string $entity,
- array $events
+ array $events,
): int {
$query = $this->connection->getQueryBuilder();
$query->insert('flow_operations')
@@ -274,7 +251,7 @@ class Manager implements IManager {
'entity' => $query->createNamedParameter($entity),
'events' => $query->createNamedParameter(json_encode($events))
]);
- $query->execute();
+ $query->executeStatement();
$this->cacheFactory->createDistributed('flow')->remove('events');
@@ -288,7 +265,7 @@ class Manager implements IManager {
* @param string $operation
* @return array The added operation
* @throws \UnexpectedValueException
- * @throw Exception
+ * @throws Exception
*/
public function addOperation(
string $class,
@@ -297,7 +274,7 @@ class Manager implements IManager {
string $operation,
ScopeContext $scope,
string $entity,
- array $events
+ array $events,
) {
$this->validateOperation($class, $name, $checks, $operation, $scope, $entity, $events);
@@ -337,7 +314,7 @@ class Manager implements IManager {
}
$qb->setParameters(['scope' => $scopeContext->getScope(), 'scopeId' => $scopeContext->getScopeId()]);
- $result = $qb->execute();
+ $result = $qb->executeQuery();
$operations = [];
while (($opId = $result->fetchOne()) !== false) {
@@ -366,7 +343,7 @@ class Manager implements IManager {
string $operation,
ScopeContext $scopeContext,
string $entity,
- array $events
+ array $events,
): array {
if (!$this->canModify($id, $scopeContext)) {
throw new \DomainException('Target operation not within scope');
@@ -417,12 +394,12 @@ class Manager implements IManager {
$this->connection->beginTransaction();
$result = (bool)$query->delete('flow_operations')
->where($query->expr()->eq('id', $query->createNamedParameter($id)))
- ->execute();
+ ->executeStatement();
if ($result) {
$qb = $this->connection->getQueryBuilder();
$result &= (bool)$qb->delete('flow_operations_scope')
->where($qb->expr()->eq('operation_id', $qb->createNamedParameter($id)))
- ->execute();
+ ->executeStatement();
}
$this->connection->commit();
} catch (Exception $e) {
@@ -561,11 +538,11 @@ class Manager implements IManager {
$query->select('*')
->from('flow_checks')
->where($query->expr()->in('id', $query->createNamedParameter($checkIds, IQueryBuilder::PARAM_INT_ARRAY)));
- $result = $query->execute();
+ $result = $query->executeQuery();
while ($row = $result->fetch()) {
- $this->checks[(int) $row['id']] = $row;
- $checks[(int) $row['id']] = $row;
+ $this->checks[(int)$row['id']] = $row;
+ $checks[(int)$row['id']] = $row;
}
$result->closeCursor();
@@ -592,11 +569,11 @@ class Manager implements IManager {
$query->select('id')
->from('flow_checks')
->where($query->expr()->eq('hash', $query->createNamedParameter($hash)));
- $result = $query->execute();
+ $result = $query->executeQuery();
if ($row = $result->fetch()) {
$result->closeCursor();
- return (int) $row['id'];
+ return (int)$row['id'];
}
$query = $this->connection->getQueryBuilder();
@@ -607,7 +584,7 @@ class Manager implements IManager {
'value' => $query->createNamedParameter($value),
'hash' => $query->createNamedParameter($hash),
]);
- $query->execute();
+ $query->executeStatement();
return $query->getLastInsertId();
}
@@ -621,7 +598,7 @@ class Manager implements IManager {
'type' => $query->createNamedParameter($scope->getScope()),
'value' => $query->createNamedParameter($scope->getScopeId()),
]);
- $insertQuery->execute();
+ $insertQuery->executeStatement();
}
public function formatOperation(array $operation): array {