diff --git a/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php b/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php
index 7b664d031816a..a5fb8ca7bba61 100644
--- a/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php
+++ b/apps/dav/lib/BackgroundJob/CleanupInvitationTokenJob.php
@@ -25,11 +25,11 @@ public function __construct(
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
}
- public function run($argument) {
+ public function run($argument): void {
$query = $this->db->getQueryBuilder();
$query->delete('calendar_invitations')
->where($query->expr()->lt('expiration',
$query->createNamedParameter($this->time->getTime())))
- ->execute();
+ ->executeStatement();
}
}
diff --git a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php
index 68bb337334648..0ddd83b6e0d62 100644
--- a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php
+++ b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php
@@ -72,12 +72,12 @@ public function getPrincipalsByPrefix($prefixPath): array {
$query = $this->db->getQueryBuilder();
$query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname'])
->from($this->dbTableName);
- $stmt = $query->execute();
+ $stmt = $query->executeQuery();
$metaDataQuery = $this->db->getQueryBuilder();
$metaDataQuery->select([$this->dbForeignKeyName, 'key', 'value'])
->from($this->dbMetaDataTableName);
- $metaDataStmt = $metaDataQuery->execute();
+ $metaDataStmt = $metaDataQuery->executeQuery();
$metaDataRows = $metaDataStmt->fetchAll(\PDO::FETCH_ASSOC);
$metaDataById = [];
@@ -128,7 +128,7 @@ public function getPrincipalByPath($path) {
->from($this->dbTableName)
->where($query->expr()->eq('backend_id', $query->createNamedParameter($backendId)))
->andWhere($query->expr()->eq('resource_id', $query->createNamedParameter($resourceId)));
- $stmt = $query->execute();
+ $stmt = $query->executeQuery();
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
if (!$row) {
@@ -139,7 +139,7 @@ public function getPrincipalByPath($path) {
$metaDataQuery->select(['key', 'value'])
->from($this->dbMetaDataTableName)
->where($metaDataQuery->expr()->eq($this->dbForeignKeyName, $metaDataQuery->createNamedParameter($row['id'])));
- $metaDataStmt = $metaDataQuery->execute();
+ $metaDataStmt = $metaDataQuery->executeQuery();
$metaDataRows = $metaDataStmt->fetchAll(\PDO::FETCH_ASSOC);
$metadata = [];
@@ -159,7 +159,7 @@ public function getPrincipalById($id): ?array {
$query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname'])
->from($this->dbTableName)
->where($query->expr()->eq('id', $query->createNamedParameter($id)));
- $stmt = $query->execute();
+ $stmt = $query->executeQuery();
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
if (!$row) {
@@ -170,7 +170,7 @@ public function getPrincipalById($id): ?array {
$metaDataQuery->select(['key', 'value'])
->from($this->dbMetaDataTableName)
->where($metaDataQuery->expr()->eq($this->dbForeignKeyName, $metaDataQuery->createNamedParameter($row['id'])));
- $metaDataStmt = $metaDataQuery->execute();
+ $metaDataStmt = $metaDataQuery->executeQuery();
$metaDataRows = $metaDataStmt->fetchAll(\PDO::FETCH_ASSOC);
$metadata = [];
@@ -219,7 +219,7 @@ public function searchPrincipals($prefixPath, array $searchProperties, $test = '
->from($this->dbTableName)
->where($query->expr()->iLike('email', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($value) . '%')));
- $stmt = $query->execute();
+ $stmt = $query->executeQuery();
$principals = [];
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
if (!$this->isAllowedToAccessResource($row, $usersGroups)) {
@@ -238,7 +238,7 @@ public function searchPrincipals($prefixPath, array $searchProperties, $test = '
->from($this->dbTableName)
->where($query->expr()->iLike('displayname', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($value) . '%')));
- $stmt = $query->execute();
+ $stmt = $query->executeQuery();
$principals = [];
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
if (!$this->isAllowedToAccessResource($row, $usersGroups)) {
@@ -406,7 +406,7 @@ public function findByUri($uri, $principalPrefix): ?string {
->from($this->dbTableName)
->where($query->expr()->eq('email', $query->createNamedParameter($email)));
- $stmt = $query->execute();
+ $stmt = $query->executeQuery();
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
if (!$row) {
@@ -433,7 +433,7 @@ public function findByUri($uri, $principalPrefix): ?string {
->from($this->dbTableName)
->where($query->expr()->eq('backend_id', $query->createNamedParameter($backendId)))
->andWhere($query->expr()->eq('resource_id', $query->createNamedParameter($resourceId)));
- $stmt = $query->execute();
+ $stmt = $query->executeQuery();
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
if (!$row) {
diff --git a/apps/dav/lib/Migration/BuildSocialSearchIndex.php b/apps/dav/lib/Migration/BuildSocialSearchIndex.php
index a808034365a2c..26a3c21079c11 100644
--- a/apps/dav/lib/Migration/BuildSocialSearchIndex.php
+++ b/apps/dav/lib/Migration/BuildSocialSearchIndex.php
@@ -7,29 +7,21 @@
namespace OCA\DAV\Migration;
use OCP\BackgroundJob\IJobList;
-use OCP\IConfig;
+use OCP\IAppConfig;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
class BuildSocialSearchIndex implements IRepairStep {
- /**
- * @param IDBConnection $db
- * @param IJobList $jobList
- * @param IConfig $config
- */
public function __construct(
- private IDBConnection $db,
- private IJobList $jobList,
- private IConfig $config,
+ private readonly IDBConnection $db,
+ private readonly IJobList $jobList,
+ private readonly IAppConfig $config,
) {
}
- /**
- * @return string
- */
- public function getName() {
+ public function getName(): string {
return 'Register building of social profile search index as background job';
}
@@ -38,7 +30,7 @@ public function getName() {
*/
public function run(IOutput $output) {
// only run once
- if ($this->config->getAppValue('dav', 'builtSocialSearchIndex') === 'yes') {
+ if ($this->config->getValueBool('dav', 'builtSocialSearchIndex')) {
$output->info('Repair step already executed');
return;
}
@@ -47,7 +39,7 @@ public function run(IOutput $output) {
$query->select($query->func()->max('cardid'))
->from('cards_properties')
->where($query->expr()->eq('name', $query->createNamedParameter('X-SOCIALPROFILE')));
- $maxId = (int)$query->execute()->fetchOne();
+ $maxId = (int)$query->executeQuery()->fetchOne();
if ($maxId === 0) {
return;
@@ -60,6 +52,6 @@ public function run(IOutput $output) {
]);
// no need to redo the repair during next upgrade
- $this->config->setAppValue('dav', 'builtSocialSearchIndex', 'yes');
+ $this->config->setValueBool('dav', 'builtSocialSearchIndex', true);
}
}
diff --git a/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php b/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php
index cd4b8b31f4d4f..8f36e1e3762aa 100644
--- a/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php
+++ b/apps/dav/lib/Migration/RefreshWebcalJobRegistrar.php
@@ -38,11 +38,11 @@ public function getName() {
/**
* @inheritdoc
*/
- public function run(IOutput $output) {
+ public function run(IOutput $output): void {
$query = $this->connection->getQueryBuilder();
$query->select(['principaluri', 'uri'])
->from('calendarsubscriptions');
- $stmt = $query->execute();
+ $stmt = $query->executeQuery();
$count = 0;
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
diff --git a/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php b/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php
index e2b2b701e744c..69d27404cdf12 100644
--- a/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php
+++ b/apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php
@@ -64,7 +64,7 @@ private function countSubscriptions(): int {
$query = $qb->select($qb->func()->count('*'))
->from('calendarsubscriptions');
- $result = $query->execute();
+ $result = $query->executeQuery();
$count = $result->fetchOne();
$result->closeCursor();
@@ -87,7 +87,7 @@ private function checkSubscriptions(): void {
->setMaxResults(self::SUBSCRIPTIONS_CHUNK_SIZE)
->setFirstResult($this->progress);
- $result = $query->execute();
+ $result = $query->executeQuery();
while ($row = $result->fetch()) {
$username = $this->getPrincipal($row['principaluri']);
if (!$this->userManager->userExists($username)) {
diff --git a/apps/dav/lib/Migration/Version1008Date20181105104826.php b/apps/dav/lib/Migration/Version1008Date20181105104826.php
index 82612307cbb7c..3ca80b5a00e2a 100644
--- a/apps/dav/lib/Migration/Version1008Date20181105104826.php
+++ b/apps/dav/lib/Migration/Version1008Date20181105104826.php
@@ -55,6 +55,6 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array
$qb = $this->connection->getQueryBuilder();
$qb->update('calendarsubscriptions')
->set('source_copy', 'source')
- ->execute();
+ ->executeStatement();
}
}
diff --git a/apps/dav/lib/Migration/Version1008Date20181105110300.php b/apps/dav/lib/Migration/Version1008Date20181105110300.php
index 72e8dee1bf8b9..520b950d8ff2e 100644
--- a/apps/dav/lib/Migration/Version1008Date20181105110300.php
+++ b/apps/dav/lib/Migration/Version1008Date20181105110300.php
@@ -54,6 +54,6 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array
$qb = $this->connection->getQueryBuilder();
$qb->update('calendarsubscriptions')
->set('source', 'source_copy')
- ->execute();
+ ->executeStatement();
}
}
diff --git a/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php b/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
index b2199e3e657a7..61f39e0a8d9b2 100644
--- a/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
@@ -39,7 +39,6 @@ public function testRun(): void {
$queryBuilder = $this->createMock(IQueryBuilder::class);
$expr = $this->createMock(IExpressionBuilder::class);
- $stmt = $this->createMock(\Doctrine\DBAL\Driver\Statement::class);
$this->dbConnection->expects($this->once())
->method('getQueryBuilder')
@@ -72,9 +71,9 @@ public function testRun(): void {
->with($function)
->willReturn($queryBuilder);
$queryBuilder->expects($this->once())
- ->method('execute')
+ ->method('executeStatement')
->with()
- ->willReturn($stmt);
+ ->willReturn(1);
$this->backgroundJob->run([]);
}
diff --git a/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php b/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php
index 8e7bf366cbfa3..105f1296b42a4 100644
--- a/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php
+++ b/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php
@@ -54,7 +54,7 @@ public function testRun(): void {
->with('calendarsubscriptions')
->willReturn($queryBuilder);
$queryBuilder->expects($this->once())
- ->method('execute')
+ ->method('executeQuery')
->willReturn($statement);
$statement->expects($this->exactly(4))
diff --git a/apps/dav/tests/unit/Migration/RemoveDeletedUsersCalendarSubscriptionsTest.php b/apps/dav/tests/unit/Migration/RemoveDeletedUsersCalendarSubscriptionsTest.php
index a9758470573d1..b7e1e258a90f3 100644
--- a/apps/dav/tests/unit/Migration/RemoveDeletedUsersCalendarSubscriptionsTest.php
+++ b/apps/dav/tests/unit/Migration/RemoveDeletedUsersCalendarSubscriptionsTest.php
@@ -72,7 +72,7 @@ public function testRun(array $subscriptions, array $userExists, int $deletions)
$result = $this->createMock(IResult::class);
- $qb->method('execute')
+ $qb->method('executeQuery')
->willReturn($result);
$result->expects($this->once())
diff --git a/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php b/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php
index e78c93ec1a50e..a57ba91650081 100644
--- a/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php
+++ b/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php
@@ -47,6 +47,6 @@ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array
$qb->update('federated_reshares')
->set('remote_id', $qb->createNamedParameter(''))
->where($qb->expr()->eq('remote_id', $qb->createNamedParameter('-1')));
- $qb->execute();
+ $qb->executeStatement();
}
}
diff --git a/apps/files/lib/Command/RepairTree.php b/apps/files/lib/Command/RepairTree.php
index 622ccba48a39d..e5b28983cf25e 100644
--- a/apps/files/lib/Command/RepairTree.php
+++ b/apps/files/lib/Command/RepairTree.php
@@ -60,7 +60,7 @@ public function execute(InputInterface $input, OutputInterface $output): int {
'path' => $row['parent_path'] . '/' . $row['name'],
'storage' => $row['parent_storage'],
]);
- $query->execute();
+ $query->executeStatement();
}
}
}
@@ -78,14 +78,14 @@ private function getFileId(int $storage, string $path) {
->from('filecache')
->where($query->expr()->eq('storage', $query->createNamedParameter($storage)))
->andWhere($query->expr()->eq('path_hash', $query->createNamedParameter(md5($path))));
- return $query->execute()->fetch(\PDO::FETCH_COLUMN);
+ return $query->executeQuery()->fetch(\PDO::FETCH_COLUMN);
}
private function deleteById(int $fileId): void {
$query = $this->connection->getQueryBuilder();
$query->delete('filecache')
->where($query->expr()->eq('fileid', $query->createNamedParameter($fileId)));
- $query->execute();
+ $query->executeStatement();
}
private function findBrokenTreeBits(): array {
@@ -108,6 +108,6 @@ private function findBrokenTreeBits(): array {
$query->expr()->neq('f.storage', 'p.storage')
));
- return $query->execute()->fetchAll();
+ return $query->executeQuery()->fetchAll();
}
}
diff --git a/apps/files_external/lib/Command/Notify.php b/apps/files_external/lib/Command/Notify.php
index 0982aa5598b11..9f42d974ecfec 100644
--- a/apps/files_external/lib/Command/Notify.php
+++ b/apps/files_external/lib/Command/Notify.php
@@ -176,7 +176,7 @@ private function getStorageIds(int $mountId, string $path): array {
->innerJoin('m', 'filecache', 'f', $qb->expr()->eq('m.storage_id', 'f.storage'))
->where($qb->expr()->eq('mount_id', $qb->createNamedParameter($mountId, IQueryBuilder::PARAM_INT)))
->andWhere($qb->expr()->eq('path_hash', $qb->createNamedParameter($pathHash, IQueryBuilder::PARAM_STR)))
- ->execute()
+ ->executeQuery()
->fetchAll();
}
diff --git a/apps/files_external/lib/Migration/Version1015Date20211104103506.php b/apps/files_external/lib/Migration/Version1015Date20211104103506.php
index 6027c795cdfee..20a279d805c4b 100644
--- a/apps/files_external/lib/Migration/Version1015Date20211104103506.php
+++ b/apps/files_external/lib/Migration/Version1015Date20211104103506.php
@@ -47,7 +47,7 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array
try {
$qb->setParameter('oldId', $oldId);
$qb->setParameter('newId', $newId);
- $qb->execute();
+ $qb->executeStatement();
$this->logger->info('Migrated s3 storage id for mount with id ' . $mount['mount_id'] . ' to ' . $newId);
} catch (Exception $e) {
$this->logger->error('Failed to migrate external s3 storage id for mount with id ' . $mount['mount_id'], [
@@ -70,7 +70,7 @@ private function getS3Mounts() {
->innerJoin('m', 'external_config', 'c', 'c.mount_id = m.mount_id')
->where($qb->expr()->eq('m.storage_backend', $qb->createPositionalParameter('amazons3')))
->andWhere($qb->expr()->eq('c.key', $qb->createPositionalParameter('bucket')));
- return $qb->execute();
+ return $qb->executeQuery();
}
/**
@@ -82,7 +82,7 @@ private function getStorageConfig(int $mountId): array {
->from('external_config')
->where($qb->expr()->eq('mount_id', $qb->createPositionalParameter($mountId)));
$config = [];
- foreach ($qb->execute()->fetchAll() as $row) {
+ foreach ($qb->executeQuery()->fetchAll() as $row) {
$config[$row['key']] = $row['value'];
}
return $config;
diff --git a/apps/files_external/lib/Service/DBConfigService.php b/apps/files_external/lib/Service/DBConfigService.php
index 41ec4512d70fb..5a8ee84ee47b5 100644
--- a/apps/files_external/lib/Service/DBConfigService.php
+++ b/apps/files_external/lib/Service/DBConfigService.php
@@ -7,7 +7,7 @@
*/
namespace OCA\Files_External\Service;
-use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
+use OCP\DB\Exception;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\Security\ICrypto;
@@ -304,8 +304,11 @@ public function setConfig($mountId, $key, $value) {
->setValue('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT))
->setValue('key', $builder->createNamedParameter($key, IQueryBuilder::PARAM_STR))
->setValue('value', $builder->createNamedParameter($value, IQueryBuilder::PARAM_STR))
- ->execute();
- } catch (UniqueConstraintViolationException $e) {
+ ->executeStatement();
+ } catch (Exception $e) {
+ if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
+ throw $e;
+ }
$builder = $this->connection->getQueryBuilder();
$query = $builder->update('external_config')
->set('value', $builder->createNamedParameter($value, IQueryBuilder::PARAM_STR))
@@ -327,8 +330,11 @@ public function setOption($mountId, $key, $value) {
->setValue('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT))
->setValue('key', $builder->createNamedParameter($key, IQueryBuilder::PARAM_STR))
->setValue('value', $builder->createNamedParameter(json_encode($value), IQueryBuilder::PARAM_STR))
- ->execute();
- } catch (UniqueConstraintViolationException $e) {
+ ->executeStatement();
+ } catch (Exception $e) {
+ if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
+ throw $e;
+ }
$builder = $this->connection->getQueryBuilder();
$query = $builder->update('external_options')
->set('value', $builder->createNamedParameter(json_encode($value), IQueryBuilder::PARAM_STR))
@@ -345,9 +351,12 @@ public function addApplicable($mountId, $type, $value) {
->setValue('mount_id', $builder->createNamedParameter($mountId))
->setValue('type', $builder->createNamedParameter($type))
->setValue('value', $builder->createNamedParameter($value))
- ->execute();
- } catch (UniqueConstraintViolationException $e) {
+ ->executeStatement();
+ } catch (Exception $e) {
// applicable exists already
+ if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
+ throw $e;
+ }
}
}
diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php
index ff4781eba0f8f..8157502baf441 100644
--- a/apps/files_sharing/lib/External/Manager.php
+++ b/apps/files_sharing/lib/External/Manager.php
@@ -8,11 +8,11 @@
namespace OCA\Files_Sharing\External;
-use Doctrine\DBAL\Driver\Exception;
use OC\Files\Filesystem;
use OCA\FederatedFileSharing\Events\FederatedShareAddedEvent;
use OCA\Files_Sharing\Helper;
use OCA\Files_Sharing\ResponseDefinitions;
+use OCP\DB\Exception;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Federation\ICloudFederationFactory;
@@ -130,39 +130,36 @@ public function addShare($remote, $token, $password, $name, $owner, $shareType,
}
/**
- * write remote share to the database
+ * Write remote share to the database.
*
- * @param $remote
- * @param $token
- * @param $password
- * @param $name
- * @param $owner
- * @param $user
- * @param $mountPoint
- * @param $hash
- * @param $accepted
- * @param $remoteId
- * @param $parent
- * @param $shareType
- *
- * @return void
- * @throws \Doctrine\DBAL\Driver\Exception
+ * @throws Exception
*/
- private function writeShareToDb($remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType): void {
- $query = $this->connection->prepare('
- INSERT INTO `*PREFIX*share_external`
- (`remote`, `share_token`, `password`, `name`, `owner`, `user`, `mountpoint`, `mountpoint_hash`, `accepted`, `remote_id`, `parent`, `share_type`)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
- ');
- $query->execute([$remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType]);
+ private function writeShareToDb(string $remote, string $token, ?string $password, string $name, string $owner, string $user, string $mountPoint, string $hash, int $accepted, string $remoteId, int $parent, int $shareType): void {
+ $qb = $this->connection->getQueryBuilder();
+ $qb->insert('share_external')
+ ->values([
+ 'remote' => $qb->createNamedParameter($remote, IQueryBuilder::PARAM_STR),
+ 'share_token' => $qb->createNamedParameter($token, IQueryBuilder::PARAM_STR),
+ 'password' => $qb->createNamedParameter($password, IQueryBuilder::PARAM_STR),
+ 'name' => $qb->createNamedParameter($name, IQueryBuilder::PARAM_STR),
+ 'owner' => $qb->createNamedParameter($owner, IQueryBuilder::PARAM_STR),
+ 'user' => $qb->createNamedParameter($user, IQueryBuilder::PARAM_STR),
+ 'mountpoint' => $qb->createNamedParameter($mountPoint, IQueryBuilder::PARAM_STR),
+ 'mountpoint_hash' => $qb->createNamedParameter($hash, IQueryBuilder::PARAM_STR),
+ 'accepted' => $qb->createNamedParameter($accepted, IQueryBuilder::PARAM_INT),
+ 'remote_id' => $qb->createNamedParameter($remoteId, IQueryBuilder::PARAM_STR),
+ 'parent' => $qb->createNamedParameter($parent, IQueryBuilder::PARAM_INT),
+ 'share_type' => $qb->createNamedParameter($shareType, IQueryBuilder::PARAM_INT),
+ ])
+ ->executeStatement();
}
private function fetchShare(int $id): array|false {
- $getShare = $this->connection->prepare('
- SELECT `id`, `remote`, `remote_id`, `share_token`, `name`, `owner`, `user`, `mountpoint`, `accepted`, `parent`, `share_type`, `password`, `mountpoint_hash`
- FROM `*PREFIX*share_external`
- WHERE `id` = ?');
- $result = $getShare->execute([$id]);
+ $qb = $this->connection->getQueryBuilder();
+ $result = $qb->select('id', 'remote', 'remote_id', 'share_token', 'name', 'owner', 'user', 'mountpoint', 'accepted', 'parent', 'share_type', 'password', 'mountpoint_hash')
+ ->from('share_external')
+ ->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)))
+ ->executeQuery();
$share = $result->fetch();
$result->closeCursor();
return $share;
@@ -174,23 +171,26 @@ private function fetchShare(int $id): array|false {
* @param string $token
* @return mixed share of false
*/
- private function fetchShareByToken($token) {
- $getShare = $this->connection->prepare('
- SELECT `id`, `remote`, `remote_id`, `share_token`, `name`, `owner`, `user`, `mountpoint`, `accepted`, `parent`, `share_type`, `password`, `mountpoint_hash`
- FROM `*PREFIX*share_external`
- WHERE `share_token` = ?');
- $result = $getShare->execute([$token]);
+ private function fetchShareByToken(string $token): array|false {
+ $qb = $this->connection->getQueryBuilder();
+ $result = $qb->select('id', 'remote', 'remote_id', 'share_token', 'name', 'owner', 'user', 'mountpoint', 'accepted', 'parent', 'share_type', 'password', 'mountpoint_hash')
+ ->from('share_external')
+ ->where($qb->expr()->eq('share_token', $qb->createNamedParameter($token, IQueryBuilder::PARAM_STR)))
+ ->executeQuery();
$share = $result->fetch();
$result->closeCursor();
return $share;
}
- private function fetchUserShare($parentId, $uid) {
- $getShare = $this->connection->prepare('
- SELECT `id`, `remote`, `remote_id`, `share_token`, `name`, `owner`, `user`, `mountpoint`, `accepted`, `parent`, `share_type`, `password`, `mountpoint_hash`
- FROM `*PREFIX*share_external`
- WHERE `parent` = ? AND `user` = ?');
- $result = $getShare->execute([$parentId, $uid]);
+ private function fetchUserShare(int $parentId, string $uid): ?array {
+ $qb = $this->connection->getQueryBuilder();
+ $result = $qb->select('id', 'remote', 'remote_id', 'share_token', 'name', 'owner', 'user', 'mountpoint', 'accepted', 'parent', 'share_type', 'password', 'mountpoint_hash')
+ ->from('share_external')
+ ->where($qb->expr()->andX(
+ $qb->expr()->eq('parent', $qb->createNamedParameter($parentId, IQueryBuilder::PARAM_INT)),
+ $qb->expr()->eq('user', $qb->createNamedParameter($uid, IQueryBuilder::PARAM_STR)),
+ ))
+ ->executeQuery();
$share = $result->fetch();
$result->closeCursor();
if ($share !== false) {
@@ -266,25 +266,21 @@ private function canAccessShare(array $share, string $user): bool {
/**
* Updates accepted flag in the database
- *
- * @param int $id
*/
- private function updateAccepted(int $shareId, bool $accepted) : void {
- $query = $this->connection->prepare('
- UPDATE `*PREFIX*share_external`
- SET `accepted` = ?
- WHERE `id` = ?');
- $updateResult = $query->execute([$accepted ? 1 : 0, $shareId]);
- $updateResult->closeCursor();
+ private function updateAccepted(int $shareId, bool $accepted): void {
+ $qb = $this->connection->getQueryBuilder();
+ $qb->update('share_external')
+ ->set('accepted', $qb->createNamedParameter($accepted ? 1 : 0, IQueryBuilder::PARAM_INT))
+ ->where($qb->expr()->eq('id', $qb->createNamedParameter($shareId, IQueryBuilder::PARAM_INT)))
+ ->executeStatement();
}
/**
* accept server-to-server share
*
- * @param int $id
* @return bool True if the share could be accepted, false otherwise
*/
- public function acceptShare(int $id, ?string $user = null) {
+ public function acceptShare(int $id, ?string $user = null): bool {
// If we're auto-accepting a share, we need to know the user id
// as there is no session available while processing the share
// from the remote server request.
@@ -306,13 +302,16 @@ public function acceptShare(int $id, ?string $user = null) {
$userShareAccepted = false;
if ((int)$share['share_type'] === IShare::TYPE_USER) {
- $acceptShare = $this->connection->prepare('
- UPDATE `*PREFIX*share_external`
- SET `accepted` = ?,
- `mountpoint` = ?,
- `mountpoint_hash` = ?
- WHERE `id` = ? AND `user` = ?');
- $userShareAccepted = $acceptShare->execute([1, $mountPoint, $hash, $id, $user]);
+ $qb = $this->connection->getQueryBuilder();
+ $qb->update('share_external')
+ ->set('accepted', $qb->createNamedParameter(1))
+ ->set('mountpoint', $qb->createNamedParameter($mountPoint))
+ ->set('mountpoint_hash', $qb->createNamedParameter($hash))
+ ->where($qb->expr()->andX(
+ $qb->expr()->eq('id', $qb->createNamedParameter($id)),
+ $qb->expr()->eq('user', $qb->createNamedParameter($user))
+ ));
+ $userShareAccepted = $qb->executeStatement();
} else {
$parentId = (int)$share['parent'];
if ($parentId !== -1) {
@@ -324,13 +323,16 @@ public function acceptShare(int $id, ?string $user = null) {
if ($subshare !== null) {
try {
- $acceptShare = $this->connection->prepare('
- UPDATE `*PREFIX*share_external`
- SET `accepted` = ?,
- `mountpoint` = ?,
- `mountpoint_hash` = ?
- WHERE `id` = ? AND `user` = ?');
- $acceptShare->execute([1, $mountPoint, $hash, $subshare['id'], $user]);
+ $qb = $this->connection->getQueryBuilder();
+ $qb->update('share_external')
+ ->set('accepted', $qb->createNamedParameter(1))
+ ->set('mountpoint', $qb->createNamedParameter($mountPoint))
+ ->set('mountpoint_hash', $qb->createNamedParameter($hash))
+ ->where($qb->expr()->andX(
+ $qb->expr()->eq('id', $qb->createNamedParameter($subshare['id'])),
+ $qb->expr()->eq('user', $qb->createNamedParameter($user))
+ ))
+ ->executeStatement();
$result = true;
} catch (Exception $e) {
$this->logger->emergency('Could not update share', ['exception' => $e]);
@@ -375,10 +377,9 @@ public function acceptShare(int $id, ?string $user = null) {
/**
* decline server-to-server share
*
- * @param int $id
* @return bool True if the share could be declined, false otherwise
*/
- public function declineShare(int $id, ?string $user = null) {
+ public function declineShare(int $id, ?string $user = null): bool {
$user = $user ?? $this->uid;
if ($user === null) {
$this->logger->error('No user specified for declining share');
@@ -389,9 +390,13 @@ public function declineShare(int $id, ?string $user = null) {
$result = false;
if ($share && (int)$share['share_type'] === IShare::TYPE_USER) {
- $removeShare = $this->connection->prepare('
- DELETE FROM `*PREFIX*share_external` WHERE `id` = ? AND `user` = ?');
- $removeShare->execute([$id, $user]);
+ $qb = $this->connection->getQueryBuilder();
+ $qb->delete('share_external')
+ ->where($qb->expr()->andX(
+ $qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)),
+ $qb->expr()->eq('user', $qb->createNamedParameter($user, IQueryBuilder::PARAM_STR))
+ ))
+ ->executeStatement();
$this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline');
$this->processNotification($id, $user);
@@ -542,19 +547,15 @@ protected function tryOCMEndPoint($remoteDomain, $token, $remoteId, $feedback) {
return false;
}
-
/**
* remove '/user/files' from the path and trailing slashes
- *
- * @param string $path
- * @return string
*/
- protected function stripPath($path) {
+ protected function stripPath(string $path): string {
$prefix = '/' . $this->uid . '/files';
return rtrim(substr($path, strlen($prefix)), '/');
}
- public function getMount($data, ?string $user = null) {
+ public function getMount(array $data, ?string $user = null) {
$user = $user ?? $this->uid;
$data['manager'] = $this;
$mountPoint = '/' . $user . '/files' . $data['mountpoint'];
@@ -567,37 +568,30 @@ public function getMount($data, ?string $user = null) {
* @param array $data
* @return Mount
*/
- protected function mountShare($data, ?string $user = null) {
+ protected function mountShare(array $data, ?string $user = null): Mount {
$mount = $this->getMount($data, $user);
$this->mountManager->addMount($mount);
return $mount;
}
- /**
- * @return \OC\Files\Mount\Manager
- */
- public function getMountManager() {
+ public function getMountManager(): \OC\Files\Mount\Manager {
return $this->mountManager;
}
- /**
- * @param string $source
- * @param string $target
- * @return bool
- */
- public function setMountPoint($source, $target) {
+ public function setMountPoint(string $source, string $target): bool {
$source = $this->stripPath($source);
$target = $this->stripPath($target);
$sourceHash = md5($source);
$targetHash = md5($target);
- $query = $this->connection->prepare('
- UPDATE `*PREFIX*share_external`
- SET `mountpoint` = ?, `mountpoint_hash` = ?
- WHERE `mountpoint_hash` = ?
- AND `user` = ?
- ');
- $result = (bool)$query->execute([$target, $targetHash, $sourceHash, $this->uid]);
+ $qb = $this->connection->getQueryBuilder();
+ $qb->update('share_external')
+ ->set('mountpoint', $qb->createNamedParameter($target))
+ ->set('mountpoint_hash', $qb->createNamedParameter($targetHash))
+ ->where($qb->expr()->eq('mountpoint_hash', $qb->createNamedParameter($sourceHash)))
+ ->andWhere($qb->expr()->eq('user', $qb->createNamedParameter($this->uid)));
+
+ $result = (bool)$qb->executeStatement();
$this->eventDispatcher->dispatchTyped(new InvalidateMountCacheEvent($this->userManager->get($this->uid)));
@@ -621,11 +615,12 @@ public function removeShare($mountPoint): bool {
$hash = md5($mountPoint);
try {
- $getShare = $this->connection->prepare('
- SELECT `remote`, `share_token`, `remote_id`, `share_type`, `id`
- FROM `*PREFIX*share_external`
- WHERE `mountpoint_hash` = ? AND `user` = ?');
- $result = $getShare->execute([$hash, $this->uid]);
+ $qb = $this->connection->getQueryBuilder();
+ $qb->select('remote', 'share_token', 'remote_id', 'share_type', 'id')
+ ->from('share_external')
+ ->where($qb->expr()->eq('mountpoint_hash', $qb->createNamedParameter($hash)))
+ ->andWhere($qb->expr()->eq('user', $qb->createNamedParameter($this->uid)));
+ $result = $qb->executeQuery();
$share = $result->fetch();
$result->closeCursor();
if ($share !== false && (int)$share['share_type'] === IShare::TYPE_USER) {
@@ -636,18 +631,16 @@ public function removeShare($mountPoint): bool {
// we still want the share to be gone to prevent undeletable remotes
}
- $query = $this->connection->prepare('
- DELETE FROM `*PREFIX*share_external`
- WHERE `id` = ?
- ');
- $deleteResult = $query->execute([(int)$share['id']]);
- $deleteResult->closeCursor();
+ $qb = $this->connection->getQueryBuilder();
+ $qb->delete('share_external')
+ ->where('id', $qb->createNamedParameter((int)$share['id']))
+ ->executeStatement();
} elseif ($share !== false && (int)$share['share_type'] === IShare::TYPE_GROUP) {
$this->updateAccepted((int)$share['id'], false);
}
- $this->removeReShares($id);
- } catch (\Doctrine\DBAL\Exception $ex) {
+ $this->removeReShares((string)$id);
+ } catch (Exception $ex) {
$this->logger->emergency('Could not update share', ['exception' => $ex]);
return false;
}
@@ -656,26 +649,23 @@ public function removeShare($mountPoint): bool {
}
/**
- * remove re-shares from share table and mapping in the federated_reshares table
- *
- * @param $mountPointId
+ * Remove re-shares from share table and mapping in the federated_reshares table
*/
- protected function removeReShares($mountPointId) {
+ protected function removeReShares(string $mountPointId): void {
$selectQuery = $this->connection->getQueryBuilder();
$query = $this->connection->getQueryBuilder();
$selectQuery->select('id')->from('share')
->where($selectQuery->expr()->eq('file_source', $query->createNamedParameter($mountPointId)));
$select = $selectQuery->getSQL();
-
$query->delete('federated_reshares')
->where($query->expr()->in('share_id', $query->createFunction($select)));
- $query->execute();
+ $query->executeStatement();
$deleteReShares = $this->connection->getQueryBuilder();
$deleteReShares->delete('share')
->where($deleteReShares->expr()->eq('file_source', $deleteReShares->createNamedParameter($mountPointId)));
- $deleteReShares->execute();
+ $deleteReShares->executeStatement();
}
/**
@@ -685,13 +675,12 @@ protected function removeReShares($mountPointId) {
*/
public function removeUserShares($uid): bool {
try {
- // TODO: use query builder
- $getShare = $this->connection->prepare('
- SELECT `id`, `remote`, `share_type`, `share_token`, `remote_id`
- FROM `*PREFIX*share_external`
- WHERE `user` = ?
- AND `share_type` = ?');
- $result = $getShare->execute([$uid, IShare::TYPE_USER]);
+ $qb = $this->connection->getQueryBuilder();
+ $qb->select('id', 'remote', 'share_type', 'share_token', 'remote_id')
+ ->from('share_external')
+ ->where($qb->expr()->eq('user', $qb->createNamedParameter($uid)))
+ ->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_USER)));
+ $result = $qb->executeQuery();
$shares = $result->fetchAll();
$result->closeCursor();
@@ -725,12 +714,12 @@ public function removeUserShares($uid): bool {
public function removeGroupShares($gid): bool {
try {
- $getShare = $this->connection->prepare('
- SELECT `id`, `remote`, `share_type`, `share_token`, `remote_id`
- FROM `*PREFIX*share_external`
- WHERE `user` = ?
- AND `share_type` = ?');
- $result = $getShare->execute([$gid, IShare::TYPE_GROUP]);
+ $qb = $this->connection->getQueryBuilder();
+ $qb->select('id', 'remote', 'share_type', 'share_token', 'remote_id')
+ ->from('share_external')
+ ->where($qb->expr()->eq('user', $qb->createNamedParameter($gid)))
+ ->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP)));
+ $result = $qb->executeQuery();
$shares = $result->fetchAll();
$result->closeCursor();
@@ -748,7 +737,7 @@ public function removeGroupShares($gid): bool {
foreach ($shares as $share) {
$qb->setParameter('share_id', $share['id']);
$qb->setParameter('share_parent_id', $share['id']);
- $qb->execute();
+ $qb->executeStatement();
}
} catch (\Doctrine\DBAL\Exception $ex) {
$this->logger->emergency('Could not delete user shares', ['exception' => $ex]);
diff --git a/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php b/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php
index 3718306e3807a..7675bc886bebf 100644
--- a/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php
+++ b/apps/files_sharing/lib/Migration/OwncloudGuestShareType.php
@@ -47,7 +47,7 @@ public function run(IOutput $output) {
$query->update('share')
->set('share_type', $query->createNamedParameter(IShare::TYPE_GUEST))
->where($query->expr()->eq('share_type', $query->createNamedParameter(IShare::TYPE_EMAIL)));
- $query->execute();
+ $query->executeStatement();
}
protected function shouldRun() {
diff --git a/apps/files_sharing/lib/Migration/SetPasswordColumn.php b/apps/files_sharing/lib/Migration/SetPasswordColumn.php
index f60af2817d46c..5a2fbaeca932b 100644
--- a/apps/files_sharing/lib/Migration/SetPasswordColumn.php
+++ b/apps/files_sharing/lib/Migration/SetPasswordColumn.php
@@ -49,7 +49,7 @@ public function run(IOutput $output) {
->set('password', 'share_with')
->where($query->expr()->eq('share_type', $query->createNamedParameter(IShare::TYPE_LINK)))
->andWhere($query->expr()->isNotNull('share_with'));
- $result = $query->execute();
+ $result = $query->executeStatement();
if ($result === 0) {
// No link updated, no need to run the second query
@@ -62,7 +62,7 @@ public function run(IOutput $output) {
->set('share_with', $clearQuery->createNamedParameter(null))
->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(IShare::TYPE_LINK)));
- $clearQuery->execute();
+ $clearQuery->executeStatement();
}
protected function shouldRun() {
diff --git a/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php b/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php
index c9fe840d42272..533612a887ee7 100644
--- a/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php
+++ b/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php
@@ -114,11 +114,11 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
return $schema;
}
- public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
+ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void {
$qb = $this->connection->getQueryBuilder();
$qb->update('share_external')
->set('remote_id', $qb->createNamedParameter(''))
->where($qb->expr()->eq('remote_id', $qb->createNamedParameter('-1')));
- $qb->execute();
+ $qb->executeStatement();
}
}
diff --git a/apps/files_sharing/lib/ShareBackend/Folder.php b/apps/files_sharing/lib/ShareBackend/Folder.php
index df5529c3c4a5b..35dc0da3c24fb 100644
--- a/apps/files_sharing/lib/ShareBackend/Folder.php
+++ b/apps/files_sharing/lib/ShareBackend/Folder.php
@@ -12,7 +12,7 @@
use OCP\Share_Backend_Collection;
class Folder extends File implements Share_Backend_Collection {
- public function getChildren($itemSource) {
+ public function getChildren($itemSource): array {
$children = [];
$parents = [$itemSource];
@@ -22,15 +22,15 @@ public function getChildren($itemSource) {
->where(
$qb->expr()->eq('mimetype', $qb->createNamedParameter('httpd/unix-directory'))
);
- $result = $qb->execute();
- $row = $result->fetch();
- $result->closeCursor();
+ $result = $qb->executeQuery();
- if ($row = $result->fetchRow()) {
+ if (($row = $result->fetch()) !== false) {
$mimetype = (int)$row['id'];
} else {
$mimetype = -1;
}
+ $result->closeCursor();
+
while (!empty($parents)) {
$qb = Server::get(IDBConnection::class)->getQueryBuilder();
@@ -44,7 +44,7 @@ public function getChildren($itemSource) {
$qb->expr()->in('parent', $parents)
);
- $result = $qb->execute();
+ $result = $qb->executeQuery();
$parents = [];
while ($file = $result->fetch()) {
diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php
index 14c6afec4d8f8..06c09fd54221f 100644
--- a/apps/files_sharing/tests/External/ManagerTest.php
+++ b/apps/files_sharing/tests/External/ManagerTest.php
@@ -116,9 +116,7 @@ protected function setUp(): void {
protected function tearDown(): void {
// clear the share external table to avoid side effects
- $query = Server::get(IDBConnection::class)->prepare('DELETE FROM `*PREFIX*share_external`');
- $result = $query->execute();
- $result->closeCursor();
+ Server::get(IDBConnection::class)->getQueryBuilder()->delete('share_external')->executeStatement();
parent::tearDown();
}
diff --git a/apps/settings/lib/Settings/Admin/Server.php b/apps/settings/lib/Settings/Admin/Server.php
index c0f29ce8f34ba..c142c26dbd690 100644
--- a/apps/settings/lib/Settings/Admin/Server.php
+++ b/apps/settings/lib/Settings/Admin/Server.php
@@ -69,7 +69,7 @@ protected function cronMaxAge(): int {
->orderBy('last_checked', 'ASC')
->setMaxResults(1);
- $result = $query->execute();
+ $result = $query->executeQuery();
if ($row = $result->fetch()) {
$maxAge = (int)$row['last_checked'];
} else {
diff --git a/apps/twofactor_backupcodes/lib/Db/BackupCodeMapper.php b/apps/twofactor_backupcodes/lib/Db/BackupCodeMapper.php
index fbbc3d0403c75..39cc37af686a9 100644
--- a/apps/twofactor_backupcodes/lib/Db/BackupCodeMapper.php
+++ b/apps/twofactor_backupcodes/lib/Db/BackupCodeMapper.php
@@ -52,6 +52,6 @@ public function deleteCodesByUserId(string $uid): void {
$qb->delete('twofactor_backupcodes')
->where($qb->expr()->eq('user_id', $qb->createNamedParameter($uid)));
- $qb->execute();
+ $qb->executeStatement();
}
}
diff --git a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607113030.php b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607113030.php
index bed733cd41349..c880b3df78f2c 100644
--- a/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607113030.php
+++ b/apps/twofactor_backupcodes/lib/Migration/Version1002Date20170607113030.php
@@ -52,7 +52,7 @@ public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array
$query->select('*')
->from('twofactor_backup_codes')
->orderBy('id', 'ASC');
- $result = $query->execute();
+ $result = $query->executeQuery();
$output->startProgress();
while ($row = $result->fetch()) {
@@ -63,7 +63,7 @@ public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array
->setParameter('user_id', $row['user_id'], IQueryBuilder::PARAM_STR)
->setParameter('code', $row['code'], IQueryBuilder::PARAM_STR)
->setParameter('used', $row['used'], IQueryBuilder::PARAM_INT)
- ->execute();
+ ->executeStatement();
}
$output->finishProgress();
}
diff --git a/apps/user_status/tests/Unit/Service/StatusServiceTest.php b/apps/user_status/tests/Unit/Service/StatusServiceTest.php
index 7dfa5b0d064b9..3d7578caf40a0 100644
--- a/apps/user_status/tests/Unit/Service/StatusServiceTest.php
+++ b/apps/user_status/tests/Unit/Service/StatusServiceTest.php
@@ -8,8 +8,6 @@
*/
namespace OCA\UserStatus\Tests\Service;
-use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
-use OC\DB\Exceptions\DbalException;
use OCA\UserStatus\Db\UserStatus;
use OCA\UserStatus\Db\UserStatusMapper;
use OCA\UserStatus\Exception\InvalidClearAtException;
@@ -671,8 +669,8 @@ public function testCleanStatusCleanedAlready(): void {
}
public function testBackupWorkingHasBackupAlready(): void {
- $p = $this->createMock(UniqueConstraintViolationException::class);
- $e = DbalException::wrap($p);
+ $e = $this->createMock(Exception::class);
+ $e->method('getReason')->willReturn(Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION);
$this->mapper->expects($this->once())
->method('createBackupStatus')
->with('john')
@@ -809,10 +807,12 @@ public function testSetUserStatus(string $messageId, string $oldMessageId, bool
->with('john')
->willReturn($previous);
- $e = DbalException::wrap($this->createMock(UniqueConstraintViolationException::class));
+ /** @var MockObject&Exception $exception */
+ $exception = $this->createMock(Exception::class);
+ $exception->method('getReason')->willReturn(Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION);
$this->mapper->expects($expectedUpdateShortcut ? $this->never() : $this->once())
->method('createBackupStatus')
- ->willThrowException($e);
+ ->willThrowException($exception);
$this->mapper->expects($this->any())
->method('update')
diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php
index 0f41679789d86..306f9cd410667 100644
--- a/apps/workflowengine/lib/Manager.php
+++ b/apps/workflowengine/lib/Manager.php
@@ -366,7 +366,7 @@ public function updateOperation(
->set('entity', $query->createNamedParameter($entity))
->set('events', $query->createNamedParameter(json_encode($events)))
->where($query->expr()->eq('id', $query->createNamedParameter($id)));
- $query->execute();
+ $query->executeStatement();
$this->connection->commit();
} catch (Exception $e) {
$this->connection->rollBack();
diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml
index 3e5b4f954174d..ef1831115672b 100644
--- a/build/psalm-baseline.xml
+++ b/build/psalm-baseline.xml
@@ -225,11 +225,6 @@
-
-
-
-
-
@@ -429,18 +424,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -880,24 +863,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -910,22 +881,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1234,7 +1189,6 @@
-
@@ -1335,14 +1289,6 @@
-
-
-
-
-
-
-
-
@@ -1422,9 +1368,6 @@
-
-
-
@@ -1476,13 +1419,6 @@
-
-
-
-
-
-
-
@@ -1504,13 +1440,6 @@
-
-
-
-
-
-
-
-
@@ -1663,14 +1591,11 @@
-
-
-
@@ -1693,15 +1618,6 @@
-
-
-
-
-
-
-
-
-
@@ -2096,7 +2012,6 @@
-
@@ -2389,17 +2304,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -2770,7 +2674,6 @@
-