aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workflowengine
diff options
context:
space:
mode:
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>2024-10-16 10:41:21 +0200
committerGit'Fellow <12234510+solracsf@users.noreply.github.com>2024-10-17 09:21:07 +0200
commitc254855222ca2776ccaa9c362b84295391cdd208 (patch)
tree0209b59a3dff7bd3a50629dfb6c8376e02dc43af /apps/workflowengine
parent4100f583f03464978e622f5765bbef33e363c97f (diff)
downloadnextcloud-server-c254855222ca2776ccaa9c362b84295391cdd208.tar.gz
nextcloud-server-c254855222ca2776ccaa9c362b84295391cdd208.zip
chore(db): Correctly apply query types
fix: psalm fix: error fix: add batch fix: fatal error fix: add batch chore: add batch chore: add batch fix: psalm fix: typo fix: psalm fix: return bool fix: revert Manager
Diffstat (limited to 'apps/workflowengine')
-rw-r--r--apps/workflowengine/lib/Manager.php24
-rw-r--r--apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php12
2 files changed, 17 insertions, 19 deletions
diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php
index f03f84a33c0..7d14fc83449 100644
--- a/apps/workflowengine/lib/Manager.php
+++ b/apps/workflowengine/lib/Manager.php
@@ -99,7 +99,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']);
@@ -145,7 +145,7 @@ 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()) {
@@ -180,7 +180,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()) {
@@ -221,7 +221,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();
@@ -250,7 +250,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');
@@ -313,7 +313,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) {
@@ -393,12 +393,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) {
@@ -537,7 +537,7 @@ 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;
@@ -568,7 +568,7 @@ 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();
@@ -583,7 +583,7 @@ class Manager implements IManager {
'value' => $query->createNamedParameter($value),
'hash' => $query->createNamedParameter($hash),
]);
- $query->execute();
+ $query->executeStatement();
return $query->getLastInsertId();
}
@@ -597,7 +597,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 {
diff --git a/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php b/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php
index 0bc380f8fc6..633d946cd7e 100644
--- a/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php
+++ b/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php
@@ -16,11 +16,9 @@ use OCP\WorkflowEngine\IManager;
class PopulateNewlyIntroducedDatabaseFields implements IRepairStep {
- /** @var IDBConnection */
- private $dbc;
-
- public function __construct(IDBConnection $dbc) {
- $this->dbc = $dbc;
+ public function __construct(
+ private IDBConnection $dbc,
+ ) {
}
public function getName() {
@@ -41,7 +39,7 @@ class PopulateNewlyIntroducedDatabaseFields implements IRepairStep {
$insertQuery = $qb->insert('flow_operations_scope');
while (($id = $ids->fetchOne()) !== false) {
$insertQuery->values(['operation_id' => $qb->createNamedParameter($id), 'type' => IManager::SCOPE_ADMIN]);
- $insertQuery->execute();
+ $insertQuery->executeStatement();
}
}
@@ -55,7 +53,7 @@ class PopulateNewlyIntroducedDatabaseFields implements IRepairStep {
// in case the repair step is executed multiple times for whatever reason.
/** @var IResult $result */
- $result = $selectQuery->execute();
+ $result = $selectQuery->executeQuery();
return $result;
}
}