diff --git a/apps/contactsinteraction/lib/Db/CardSearchDao.php b/apps/contactsinteraction/lib/Db/CardSearchDao.php
index 09fa4711adb29..b1dadd6cfbcaa 100644
--- a/apps/contactsinteraction/lib/Db/CardSearchDao.php
+++ b/apps/contactsinteraction/lib/Db/CardSearchDao.php
@@ -15,10 +15,10 @@
use function stream_get_contents;
class CardSearchDao {
- private IDBConnection $db;
- public function __construct(IDBConnection $db) {
- $this->db = $db;
+ public function __construct(
+ private IDBConnection $db,
+ ) {
}
public function findExisting(IUser $user,
@@ -65,7 +65,7 @@ public function findExisting(IUser $user,
->where($cardQuery->expr()->in('id', $cardQuery->createFunction($propQuery->getSQL()), IQueryBuilder::PARAM_INT_ARRAY))
->andWhere($cardQuery->expr()->in('addressbookid', $cardQuery->createFunction($addressbooksQuery->getSQL()), IQueryBuilder::PARAM_INT_ARRAY))
->setMaxResults(1);
- $result = $cardQuery->execute();
+ $result = $cardQuery->executeQuery();
/** @var string|resource|false $card */
$card = $result->fetchOne();
diff --git a/apps/dav/lib/CalDAV/Schedule/IMipService.php b/apps/dav/lib/CalDAV/Schedule/IMipService.php
index a101cb05db302..5b6efba990911 100644
--- a/apps/dav/lib/CalDAV/Schedule/IMipService.php
+++ b/apps/dav/lib/CalDAV/Schedule/IMipService.php
@@ -27,13 +27,7 @@
class IMipService {
- private URLGenerator $urlGenerator;
- private IConfig $config;
- private IDBConnection $db;
- private ISecureRandom $random;
- private L10NFactory $l10nFactory;
private IL10N $l10n;
- private ITimeFactory $timeFactory;
/** @var string[] */
private const STRING_DIFF = [
@@ -43,20 +37,16 @@ class IMipService {
'meeting_location' => 'LOCATION'
];
- public function __construct(URLGenerator $urlGenerator,
- IConfig $config,
- IDBConnection $db,
- ISecureRandom $random,
- L10NFactory $l10nFactory,
- ITimeFactory $timeFactory) {
- $this->urlGenerator = $urlGenerator;
- $this->config = $config;
- $this->db = $db;
- $this->random = $random;
- $this->l10nFactory = $l10nFactory;
+ public function __construct(
+ private URLGenerator $urlGenerator,
+ private IConfig $config,
+ private IDBConnection $db,
+ private ISecureRandom $random,
+ private L10NFactory $l10nFactory,
+ private ITimeFactory $timeFactory,
+ ) {
$default = $this->l10nFactory->findGenericLanguage();
$this->l10n = $this->l10nFactory->get('dav', $default);
- $this->timeFactory = $timeFactory;
}
/**
@@ -912,7 +902,7 @@ public function createInvitationToken(Message $iTipMessage, VEvent $vevent, int
'expiration' => $query->createNamedParameter($lastOccurrence),
'uid' => $query->createNamedParameter($uid)
])
- ->execute();
+ ->executeStatement();
return $token;
}
diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php
index b94da9fa7ed1a..f7d0a888efd79 100644
--- a/apps/dav/lib/CardDAV/CardDavBackend.php
+++ b/apps/dav/lib/CardDAV/CardDavBackend.php
@@ -200,7 +200,7 @@ public function getUsersOwnAddressBooks($principalUri) {
$addressBooks = [];
- $result = $query->execute();
+ $result = $query->executeQuery();
while ($row = $result->fetch()) {
$addressBooks[$row['id']] = [
'id' => $row['id'],
@@ -395,7 +395,7 @@ public function createAddressBook($principalUri, $url, array $properties) {
'synctoken' => $query->createParameter('synctoken'),
])
->setParameters($values)
- ->execute();
+ ->executeStatement();
$addressBookId = $query->getLastInsertId();
return [
@@ -479,7 +479,7 @@ public function getCards($addressbookId) {
$cards = [];
- $result = $query->execute();
+ $result = $query->executeQuery();
while ($row = $result->fetch()) {
$row['etag'] = '"' . $row['etag'] . '"';
@@ -516,7 +516,7 @@ public function getCard($addressBookId, $cardUri) {
->andWhere($query->expr()->eq('uri', $query->createNamedParameter($cardUri)))
->setMaxResults(1);
- $result = $query->execute();
+ $result = $query->executeQuery();
$row = $result->fetch();
if (!$row) {
return false;
@@ -560,7 +560,7 @@ public function getMultipleCards($addressBookId, array $uris) {
foreach ($chunks as $uris) {
$query->setParameter('uri', $uris, IQueryBuilder::PARAM_STR_ARRAY);
- $result = $query->execute();
+ $result = $query->executeQuery();
while ($row = $result->fetch()) {
$row['etag'] = '"' . $row['etag'] . '"';
@@ -634,7 +634,7 @@ public function createCard($addressBookId, $cardUri, $cardData, bool $checkAlrea
'etag' => $query->createNamedParameter($etag),
'uid' => $query->createNamedParameter($uid),
])
- ->execute();
+ ->executeStatement();
$etagCacheKey = "$addressBookId#$cardUri";
$this->etagCache[$etagCacheKey] = $etag;
@@ -697,7 +697,7 @@ public function updateCard($addressBookId, $cardUri, $cardData) {
->set('uid', $query->createNamedParameter($uid))
->where($query->expr()->eq('uri', $query->createNamedParameter($cardUri)))
->andWhere($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId)))
- ->execute();
+ ->executeStatement();
$this->etagCache[$etagCacheKey] = $etag;
@@ -1165,7 +1165,7 @@ private function searchByAddressBookIds(array $addressBookIds,
*/
}
- $result = $query2->execute();
+ $result = $query2->executeQuery();
$matches = $result->fetchAll();
$result->closeCursor();
$matches = array_map(function ($match) {
@@ -1207,7 +1207,7 @@ public function collectCardProperties($bookId, $name) {
->from($this->dbCardsPropertiesTable)
->where($query->expr()->eq('name', $query->createNamedParameter($name)))
->andWhere($query->expr()->eq('addressbookid', $query->createNamedParameter($bookId)))
- ->execute();
+ ->executeQuery();
$all = $result->fetchAll(PDO::FETCH_COLUMN);
$result->closeCursor();
@@ -1227,7 +1227,7 @@ public function getCardUri($id) {
->where($query->expr()->eq('id', $query->createParameter('id')))
->setParameter('id', $id);
- $result = $query->execute();
+ $result = $query->executeQuery();
$uri = $result->fetch();
$result->closeCursor();
@@ -1251,7 +1251,7 @@ public function getContact($addressBookId, $uri) {
$query->select('*')->from($this->dbCardsTable)
->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
->andWhere($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId)));
- $queryResult = $query->execute();
+ $queryResult = $query->executeQuery();
$contact = $queryResult->fetch();
$queryResult->closeCursor();
@@ -1324,7 +1324,7 @@ protected function updateProperties($addressBookId, $cardUri, $vCardSerialized)
$query->setParameter('name', $property->name);
$query->setParameter('value', mb_strcut($property->getValue(), 0, 254));
$query->setParameter('preferred', $preferred);
- $query->execute();
+ $query->executeStatement();
}
}, $this->db);
}
@@ -1350,7 +1350,7 @@ protected function purgeProperties($addressBookId, $cardId) {
$query->delete($this->dbCardsPropertiesTable)
->where($query->expr()->eq('cardid', $query->createNamedParameter($cardId)))
->andWhere($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId)));
- $query->execute();
+ $query->executeStatement();
}
/**
@@ -1362,7 +1362,7 @@ protected function getCardId(int $addressBookId, string $uri): int {
->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
->andWhere($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId)));
- $result = $query->execute();
+ $result = $query->executeQuery();
$cardIds = $result->fetch();
$result->closeCursor();
diff --git a/apps/dav/lib/Migration/BuildCalendarSearchIndex.php b/apps/dav/lib/Migration/BuildCalendarSearchIndex.php
index 592a6f85bdc73..b157934a1ff95 100644
--- a/apps/dav/lib/Migration/BuildCalendarSearchIndex.php
+++ b/apps/dav/lib/Migration/BuildCalendarSearchIndex.php
@@ -13,26 +13,11 @@
class BuildCalendarSearchIndex implements IRepairStep {
- /** @var IDBConnection */
- private $db;
-
- /** @var IJobList */
- private $jobList;
-
- /** @var IConfig */
- private $config;
-
- /**
- * @param IDBConnection $db
- * @param IJobList $jobList
- * @param IConfig $config
- */
- public function __construct(IDBConnection $db,
- IJobList $jobList,
- IConfig $config) {
- $this->db = $db;
- $this->jobList = $jobList;
- $this->config = $config;
+ public function __construct(
+ private IDBConnection $db,
+ private IJobList $jobList,
+ private IConfig $config,
+ ) {
}
/**
@@ -55,7 +40,7 @@ public function run(IOutput $output) {
$query = $this->db->getQueryBuilder();
$query->select($query->createFunction('MAX(' . $query->getColumnName('id') . ')'))
->from('calendarobjects');
- $result = $query->execute();
+ $result = $query->executeQuery();
$maxId = (int)$result->fetchOne();
$result->closeCursor();
diff --git a/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php b/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php
index f9a12ecbfae8a..7f74390f88386 100644
--- a/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php
+++ b/apps/dav/lib/Migration/RegisterBuildReminderIndexBackgroundJob.php
@@ -22,15 +22,6 @@
*/
class RegisterBuildReminderIndexBackgroundJob implements IRepairStep {
- /** @var IDBConnection */
- private $db;
-
- /** @var IJobList */
- private $jobList;
-
- /** @var IConfig */
- private $config;
-
/** @var string */
private const CONFIG_KEY = 'buildCalendarReminderIndex';
@@ -39,12 +30,11 @@ class RegisterBuildReminderIndexBackgroundJob implements IRepairStep {
* @param IJobList $jobList
* @param IConfig $config
*/
- public function __construct(IDBConnection $db,
- IJobList $jobList,
- IConfig $config) {
- $this->db = $db;
- $this->jobList = $jobList;
- $this->config = $config;
+ public function __construct(
+ private IDBConnection $db,
+ private IJobList $jobList,
+ private IConfig $config,
+ ) {
}
/**
@@ -67,7 +57,7 @@ public function run(IOutput $output) {
$query = $this->db->getQueryBuilder();
$query->select($query->createFunction('MAX(' . $query->getColumnName('id') . ')'))
->from('calendarobjects');
- $result = $query->execute();
+ $result = $query->executeQuery();
$maxId = (int)$result->fetchOne();
$result->closeCursor();
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php
index f349bb2a6fc36..da55b9a03d75c 100644
--- a/apps/federatedfilesharing/lib/FederatedShareProvider.php
+++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php
@@ -267,7 +267,7 @@ protected function getShareFromExternalShareTable(IShare $share) {
$query->select('*')->from($this->externalShareTable)
->where($query->expr()->eq('user', $query->createNamedParameter($share->getShareOwner())))
->andWhere($query->expr()->eq('mountpoint', $query->createNamedParameter($share->getTarget())));
- $qResult = $query->execute();
+ $qResult = $query->executeQuery();
$result = $qResult->fetchAll();
$qResult->closeCursor();
@@ -313,7 +313,7 @@ private function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ui
*/
$qb->setValue('file_target', $qb->createNamedParameter(''));
- $qb->execute();
+ $qb->executeStatement();
return $qb->getLastInsertId();
}
@@ -334,7 +334,7 @@ public function update(IShare $share) {
->set('uid_owner', $qb->createNamedParameter($share->getShareOwner()))
->set('uid_initiator', $qb->createNamedParameter($share->getSharedBy()))
->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
- ->execute();
+ ->executeStatement();
// send the updated permission to the owner/initiator, if they are not the same
if ($share->getShareOwner() !== $share->getSharedBy()) {
@@ -374,7 +374,7 @@ protected function updateSuccessfulReShare($shareId, $token) {
$query->update('share')
->where($query->expr()->eq('id', $query->createNamedParameter($shareId)))
->set('token', $query->createNamedParameter($token))
- ->execute();
+ ->executeStatement();
}
/**
@@ -392,7 +392,7 @@ public function storeRemoteId(int $shareId, string $remoteId): void {
'remote_id' => $query->createNamedParameter($remoteId),
]
);
- $query->execute();
+ $query->executeStatement();
}
/**
@@ -406,7 +406,7 @@ public function getRemoteId(IShare $share): string {
$query = $this->dbConnection->getQueryBuilder();
$query->select('remote_id')->from('federated_reshares')
->where($query->expr()->eq('share_id', $query->createNamedParameter((int)$share->getId())));
- $result = $query->execute();
+ $result = $query->executeQuery();
$data = $result->fetch();
$result->closeCursor();
@@ -444,7 +444,7 @@ public function getChildren(IShare $parent) {
->andWhere($qb->expr()->in('share_type', $qb->createNamedParameter($this->supportedShareType, IQueryBuilder::PARAM_INT_ARRAY)))
->orderBy('id');
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
while ($data = $cursor->fetch()) {
$children[] = $this->createShareObject($data);
}
@@ -524,12 +524,12 @@ private function removeShareFromTableById($shareId) {
$qb->delete('share')
->where($qb->expr()->eq('id', $qb->createNamedParameter($shareId)))
->andWhere($qb->expr()->neq('share_type', $qb->createNamedParameter(IShare::TYPE_CIRCLE)));
- $qb->execute();
+ $qb->executeStatement();
$qb = $this->dbConnection->getQueryBuilder();
$qb->delete('federated_reshares')
->where($qb->expr()->eq('share_id', $qb->createNamedParameter($shareId)));
- $qb->execute();
+ $qb->executeStatement();
}
/**
@@ -583,7 +583,7 @@ public function getSharesInFolder($userId, Folder $node, $reshares, $shallow = t
$qb->orderBy('id');
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
$shares = [];
while ($data = $cursor->fetch()) {
$shares[$data['fileid']][] = $this->createShareObject($data);
@@ -639,7 +639,7 @@ public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offs
$qb->setFirstResult($offset);
$qb->orderBy('id');
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
$shares = [];
while ($data = $cursor->fetch()) {
$shares[] = $this->createShareObject($data);
@@ -660,7 +660,7 @@ public function getShareById($id, $recipientId = null) {
->where($qb->expr()->eq('id', $qb->createNamedParameter($id)))
->andWhere($qb->expr()->in('share_type', $qb->createNamedParameter($this->supportedShareType, IQueryBuilder::PARAM_INT_ARRAY)));
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
$data = $cursor->fetch();
$cursor->closeCursor();
@@ -691,7 +691,7 @@ public function getSharesByPath(Node $path) {
->from('share')
->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($path->getId())))
->andWhere($qb->expr()->in('share_type', $qb->createNamedParameter($this->supportedShareType, IQueryBuilder::PARAM_INT_ARRAY)))
- ->execute();
+ ->executeQuery();
$shares = [];
while ($data = $cursor->fetch()) {
@@ -731,7 +731,7 @@ public function getSharedWith($userId, $shareType, $node, $limit, $offset) {
$qb->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($node->getId())));
}
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
while ($data = $cursor->fetch()) {
$shares[] = $this->createShareObject($data);
@@ -756,7 +756,7 @@ public function getShareByToken($token) {
->from('share')
->where($qb->expr()->in('share_type', $qb->createNamedParameter($this->supportedShareType, IQueryBuilder::PARAM_INT_ARRAY)))
->andWhere($qb->expr()->eq('token', $qb->createNamedParameter($token)))
- ->execute();
+ ->executeQuery();
$data = $cursor->fetch();
@@ -787,7 +787,7 @@ private function getRawShare($id) {
->from('share')
->where($qb->expr()->eq('id', $qb->createNamedParameter($id)));
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
$data = $cursor->fetch();
$cursor->closeCursor();
@@ -884,7 +884,7 @@ public function userDeleted($uid, $shareType) {
$qb->delete('share')
->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_REMOTE)))
->andWhere($qb->expr()->eq('uid_owner', $qb->createNamedParameter($uid)))
- ->execute();
+ ->executeStatement();
}
/**
@@ -1015,7 +1015,7 @@ public function getAccessList($nodes, $currentAccess) {
$qb->expr()->eq('item_type', $qb->createNamedParameter('file')),
$qb->expr()->eq('item_type', $qb->createNamedParameter('folder'))
));
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
if ($currentAccess === false) {
$remote = $cursor->fetch() !== false;
@@ -1048,7 +1048,7 @@ public function getAllShares(): iterable {
)
);
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
while ($data = $cursor->fetch()) {
try {
$share = $this->createShareObject($data);
diff --git a/apps/files/lib/Command/DeleteOrphanedFiles.php b/apps/files/lib/Command/DeleteOrphanedFiles.php
index 4bbee0b45f4f2..966351e4da062 100644
--- a/apps/files/lib/Command/DeleteOrphanedFiles.php
+++ b/apps/files/lib/Command/DeleteOrphanedFiles.php
@@ -147,11 +147,11 @@ private function cleanupOrphanedMounts(): int {
$deletedInLastChunk = self::CHUNK_SIZE;
while ($deletedInLastChunk === self::CHUNK_SIZE) {
$deletedInLastChunk = 0;
- $result = $query->execute();
+ $result = $query->executeQuery();
while ($row = $result->fetch()) {
$deletedInLastChunk++;
$deletedEntries += $deleteQuery->setParameter('storageid', (int)$row['storage_id'])
- ->execute();
+ ->executeStatement();
}
$result->closeCursor();
}
diff --git a/apps/files_external/lib/Service/DBConfigService.php b/apps/files_external/lib/Service/DBConfigService.php
index 6fb7e01271e3e..3820f6b0d96a2 100644
--- a/apps/files_external/lib/Service/DBConfigService.php
+++ b/apps/files_external/lib/Service/DBConfigService.php
@@ -24,25 +24,10 @@ class DBConfigService {
public const APPLICABLE_TYPE_GROUP = 2;
public const APPLICABLE_TYPE_USER = 3;
- /**
- * @var IDBConnection
- */
- private $connection;
-
- /**
- * @var ICrypto
- */
- private $crypto;
-
- /**
- * DBConfigService constructor.
- *
- * @param IDBConnection $connection
- * @param ICrypto $crypto
- */
- public function __construct(IDBConnection $connection, ICrypto $crypto) {
- $this->connection = $connection;
- $this->crypto = $crypto;
+ public function __construct(
+ private IDBConnection $connection,
+ private ICrypto $crypto,
+ ) {
}
public function getMountById(int $mountId): ?array {
@@ -112,7 +97,7 @@ protected function modifyMountsOnDelete(string $applicableId, int $applicableTyp
)
)
->groupBy(['a.mount_id']);
- $stmt = $query->execute();
+ $stmt = $query->executeQuery();
$result = $stmt->fetchAll();
$stmt->closeCursor();
@@ -243,7 +228,7 @@ public function addMount($mountPoint, $storageBackend, $authBackend, $priority,
'priority' => $builder->createNamedParameter($priority, IQueryBuilder::PARAM_INT),
'type' => $builder->createNamedParameter($type, IQueryBuilder::PARAM_INT)
]);
- $query->execute();
+ $query->executeStatement();
return $query->getLastInsertId();
}
@@ -256,22 +241,22 @@ public function removeMount($mountId) {
$builder = $this->connection->getQueryBuilder();
$query = $builder->delete('external_mounts')
->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT)));
- $query->execute();
+ $query->executeStatement();
$builder = $this->connection->getQueryBuilder();
$query = $builder->delete('external_applicable')
->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT)));
- $query->execute();
+ $query->executeStatement();
$builder = $this->connection->getQueryBuilder();
$query = $builder->delete('external_config')
->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT)));
- $query->execute();
+ $query->executeStatement();
$builder = $this->connection->getQueryBuilder();
$query = $builder->delete('external_options')
->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT)));
- $query->execute();
+ $query->executeStatement();
}
/**
@@ -285,7 +270,7 @@ public function setMountPoint($mountId, $newMountPoint) {
->set('mount_point', $builder->createNamedParameter($newMountPoint))
->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT)));
- $query->execute();
+ $query->executeStatement();
}
/**
@@ -299,7 +284,7 @@ public function setAuthBackend($mountId, $newAuthBackend) {
->set('auth_backend', $builder->createNamedParameter($newAuthBackend))
->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT)));
- $query->execute();
+ $query->executeStatement();
}
/**
@@ -325,7 +310,7 @@ public function setConfig($mountId, $key, $value) {
->set('value', $builder->createNamedParameter($value, IQueryBuilder::PARAM_STR))
->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT)))
->andWhere($builder->expr()->eq('key', $builder->createNamedParameter($key, IQueryBuilder::PARAM_STR)));
- $query->execute();
+ $query->executeStatement();
}
}
@@ -348,7 +333,7 @@ public function setOption($mountId, $key, $value) {
->set('value', $builder->createNamedParameter(json_encode($value), IQueryBuilder::PARAM_STR))
->where($builder->expr()->eq('mount_id', $builder->createNamedParameter($mountId, IQueryBuilder::PARAM_INT)))
->andWhere($builder->expr()->eq('key', $builder->createNamedParameter($key, IQueryBuilder::PARAM_STR)));
- $query->execute();
+ $query->executeStatement();
}
}
@@ -377,11 +362,11 @@ public function removeApplicable($mountId, $type, $value) {
$query = $query->andWhere($builder->expr()->eq('value', $builder->createNamedParameter($value, IQueryBuilder::PARAM_STR)));
}
- $query->execute();
+ $query->executeStatement();
}
private function getMountsFromQuery(IQueryBuilder $query) {
- $result = $query->execute();
+ $result = $query->executeQuery();
$mounts = $result->fetchAll();
$uniqueMounts = [];
foreach ($mounts as $mount) {
@@ -432,7 +417,7 @@ private function selectForMounts($table, array $fields, array $mountIds) {
->from($table)
->where($builder->expr()->in('mount_id', $placeHolders));
- $result = $query->execute();
+ $result = $query->executeQuery();
$rows = $result->fetchAll();
$result->closeCursor();
diff --git a/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php b/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php
index 44b473ac64d61..ca4c82c03d756 100644
--- a/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php
+++ b/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php
@@ -36,7 +36,7 @@ public function run($argument) {
$qb->selectDistinct('remote')
->from('share_external');
- $result = $qb->execute();
+ $result = $qb->executeQuery();
while ($row = $result->fetch()) {
$this->discoveryService->discover($row['remote'], 'FEDERATED_SHARING', true);
try {
diff --git a/apps/files_sharing/lib/SharedMount.php b/apps/files_sharing/lib/SharedMount.php
index 420de6889bf36..6a5a55abed26e 100644
--- a/apps/files_sharing/lib/SharedMount.php
+++ b/apps/files_sharing/lib/SharedMount.php
@@ -32,39 +32,23 @@ class SharedMount extends MountPoint implements MoveableMount, ISharedMountPoint
*/
protected $storage = null;
- /**
- * @var \OC\Files\View
- */
- private $recipientView;
-
- private IUser $user;
-
/** @var \OCP\Share\IShare */
private $superShare;
/** @var \OCP\Share\IShare[] */
private $groupedShares;
- private IEventDispatcher $eventDispatcher;
-
- private ICache $cache;
-
public function __construct(
$storage,
array $mountpoints,
$arguments,
IStorageFactory $loader,
- View $recipientView,
+ private View $recipientView,
CappedMemoryCache $folderExistCache,
- IEventDispatcher $eventDispatcher,
- IUser $user,
- ICache $cache,
+ private IEventDispatcher $eventDispatcher,
+ private IUser $user,
+ private ICache $cache,
) {
- $this->user = $user;
- $this->recipientView = $recipientView;
- $this->eventDispatcher = $eventDispatcher;
- $this->cache = $cache;
-
$this->superShare = $arguments['superShare'];
$this->groupedShares = $arguments['groupedShares'];
@@ -271,7 +255,7 @@ public function getNumericStorageId() {
->from('filecache')
->where($builder->expr()->eq('fileid', $builder->createNamedParameter($this->getStorageRootId())));
- $result = $query->execute();
+ $result = $query->executeQuery();
$row = $result->fetch();
$result->closeCursor();
if ($row) {
diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php
index a8f0cf84d7610..673789f946b21 100644
--- a/apps/user_ldap/lib/Mapping/AbstractMapping.php
+++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php
@@ -435,7 +435,7 @@ public function count(): int {
$query = $this->dbc->getQueryBuilder();
$query->select($query->func()->count('ldap_dn_hash'))
->from($this->getTableName());
- $res = $query->execute();
+ $res = $query->executeQuery();
$count = $res->fetchOne();
$res->closeCursor();
return (int)$count;
@@ -446,7 +446,7 @@ public function countInvalidated(): int {
$query->select($query->func()->count('ldap_dn_hash'))
->from($this->getTableName())
->where($query->expr()->like('directory_uuid', $query->createNamedParameter('invalidated_%')));
- $res = $query->execute();
+ $res = $query->executeQuery();
$count = $res->fetchOne();
$res->closeCursor();
return (int)$count;
diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php
index f03f84a33c01d..7d14fc834491e 100644
--- a/apps/workflowengine/lib/Manager.php
+++ b/apps/workflowengine/lib/Manager.php
@@ -99,7 +99,7 @@ public function getAllConfiguredEvents() {
->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 @@ public function getAllConfiguredScopesForOperation(string $operationClass): arra
->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 @@ public function getAllOperations(ScopeContext $scopeContext): array {
}
$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 @@ protected function getOperation($id) {
$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 @@ protected function insertOperation(
'entity' => $query->createNamedParameter($entity),
'events' => $query->createNamedParameter(json_encode($events))
]);
- $query->execute();
+ $query->executeStatement();
$this->cacheFactory->createDistributed('flow')->remove('events');
@@ -313,7 +313,7 @@ protected function canModify(int $id, ScopeContext $scopeContext):bool {
}
$qb->setParameters(['scope' => $scopeContext->getScope(), 'scopeId' => $scopeContext->getScopeId()]);
- $result = $qb->execute();
+ $result = $qb->executeQuery();
$operations = [];
while (($opId = $result->fetchOne()) !== false) {
@@ -393,12 +393,12 @@ public function deleteOperation($id, ScopeContext $scopeContext) {
$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 @@ public function getChecks(array $checkIds) {
$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 @@ protected function addCheck($class, $operator, $value) {
$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 @@ protected function addCheck($class, $operator, $value) {
'value' => $query->createNamedParameter($value),
'hash' => $query->createNamedParameter($hash),
]);
- $query->execute();
+ $query->executeStatement();
return $query->getLastInsertId();
}
@@ -597,7 +597,7 @@ protected function addScope(int $operationId, ScopeContext $scope): void {
'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 0bc380f8fc683..633d946cd7e40 100644
--- a/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php
+++ b/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php
@@ -16,11 +16,9 @@
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 @@ protected function populateScopeTable(IResult $ids): void {
$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 @@ protected function getIdsWithoutScope(): IResult {
// in case the repair step is executed multiple times for whatever reason.
/** @var IResult $result */
- $result = $selectQuery->execute();
+ $result = $selectQuery->executeQuery();
return $result;
}
}
diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml
index 628c307cae771..22ecf47ec8e3d 100644
--- a/build/psalm-baseline.xml
+++ b/build/psalm-baseline.xml
@@ -2167,14 +2167,6 @@
-
-
- execute()]]>
-
-
-
-
-
diff --git a/core/Command/Preview/ResetRenderedTexts.php b/core/Command/Preview/ResetRenderedTexts.php
index 12f7d237d8f34..4cae315e48b67 100644
--- a/core/Command/Preview/ResetRenderedTexts.php
+++ b/core/Command/Preview/ResetRenderedTexts.php
@@ -120,7 +120,7 @@ private function getPreviewsToDelete(): \Iterator {
$qb->select('path', 'mimetype')
->from('filecache')
->where($qb->expr()->eq('fileid', $qb->createNamedParameter($this->previewFolder->getId())));
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
$data = $cursor->fetch();
$cursor->closeCursor();
@@ -153,7 +153,7 @@ private function getPreviewsToDelete(): \Iterator {
)
);
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
while ($row = $cursor->fetch()) {
yield $row;
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index 2ab2beb6d3ea9..0d091786cd69f 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -243,7 +243,7 @@ public function deleteUser(IUser $user): void {
$query = $this->connection->getQueryBuilder();
$query->delete($this->table)
->where($query->expr()->eq('uid', $query->createNamedParameter($uid)))
- ->execute();
+ ->executeStatement();
$this->deleteUserData($user);
}
@@ -256,7 +256,7 @@ public function deleteUserData(IUser $user): void {
$query = $this->connection->getQueryBuilder();
$query->delete($this->dataTable)
->where($query->expr()->eq('uid', $query->createNamedParameter($uid)))
- ->execute();
+ ->executeStatement();
}
/**
diff --git a/lib/private/Authentication/Token/PublicKeyTokenMapper.php b/lib/private/Authentication/Token/PublicKeyTokenMapper.php
index b1341fe1898e7..9aabd69e57a12 100644
--- a/lib/private/Authentication/Token/PublicKeyTokenMapper.php
+++ b/lib/private/Authentication/Token/PublicKeyTokenMapper.php
@@ -31,7 +31,7 @@ public function invalidate(string $token) {
$qb->delete($this->tableName)
->where($qb->expr()->eq('token', $qb->createNamedParameter($token)))
->andWhere($qb->expr()->eq('version', $qb->createNamedParameter(PublicKeyToken::VERSION, IQueryBuilder::PARAM_INT)))
- ->execute();
+ ->executeStatement();
}
/**
@@ -73,7 +73,7 @@ public function getToken(string $token): PublicKeyToken {
->from($this->tableName)
->where($qb->expr()->eq('token', $qb->createNamedParameter($token)))
->andWhere($qb->expr()->eq('version', $qb->createNamedParameter(PublicKeyToken::VERSION, IQueryBuilder::PARAM_INT)))
- ->execute();
+ ->executeQuery();
$data = $result->fetch();
$result->closeCursor();
@@ -95,7 +95,7 @@ public function getTokenById(int $id): PublicKeyToken {
->from($this->tableName)
->where($qb->expr()->eq('id', $qb->createNamedParameter($id)))
->andWhere($qb->expr()->eq('version', $qb->createNamedParameter(PublicKeyToken::VERSION, IQueryBuilder::PARAM_INT)))
- ->execute();
+ ->executeQuery();
$data = $result->fetch();
$result->closeCursor();
@@ -122,7 +122,7 @@ public function getTokenByUser(string $uid): array {
->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
->andWhere($qb->expr()->eq('version', $qb->createNamedParameter(PublicKeyToken::VERSION, IQueryBuilder::PARAM_INT)))
->setMaxResults(1000);
- $result = $qb->execute();
+ $result = $qb->executeQuery();
$data = $result->fetchAll();
$result->closeCursor();
@@ -154,7 +154,7 @@ public function deleteByName(string $name) {
$qb->delete($this->tableName)
->where($qb->expr()->eq('name', $qb->createNamedParameter($name), IQueryBuilder::PARAM_STR))
->andWhere($qb->expr()->eq('version', $qb->createNamedParameter(PublicKeyToken::VERSION, IQueryBuilder::PARAM_INT)));
- $qb->execute();
+ $qb->executeStatement();
}
public function deleteTempToken(PublicKeyToken $except) {
@@ -166,7 +166,7 @@ public function deleteTempToken(PublicKeyToken $except) {
->andWhere($qb->expr()->neq('id', $qb->createNamedParameter($except->getId())))
->andWhere($qb->expr()->eq('version', $qb->createNamedParameter(PublicKeyToken::VERSION, IQueryBuilder::PARAM_INT)));
- $qb->execute();
+ $qb->executeStatement();
}
public function hasExpiredTokens(string $uid): bool {
@@ -177,7 +177,7 @@ public function hasExpiredTokens(string $uid): bool {
->andWhere($qb->expr()->eq('password_invalid', $qb->createNamedParameter(true), IQueryBuilder::PARAM_BOOL))
->setMaxResults(1);
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
$data = $cursor->fetchAll();
$cursor->closeCursor();
diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php
index bbeb8c4207589..cdf9ca9991a1f 100644
--- a/lib/private/Files/Cache/Propagator.php
+++ b/lib/private/Files/Cache/Propagator.php
@@ -45,7 +45,6 @@ public function __construct(\OC\Files\Storage\Storage $storage, IDBConnection $c
$this->ignore = $ignore;
}
-
/**
* @param string $internalPath
* @param int $time
@@ -200,13 +199,13 @@ public function commitBatch() {
$query->setParameter('time', $item['time'], IQueryBuilder::PARAM_INT);
$query->setParameter('hash', $item['hash']);
- $query->execute();
+ $query->executeStatement();
if ($item['size']) {
$sizeQuery->setParameter('size', $item['size'], IQueryBuilder::PARAM_INT);
$sizeQuery->setParameter('hash', $item['hash']);
- $sizeQuery->execute();
+ $sizeQuery->executeStatement();
}
}
diff --git a/lib/private/Files/Cache/StorageGlobal.php b/lib/private/Files/Cache/StorageGlobal.php
index b55c0fcdb91a0..bab31b1db9115 100644
--- a/lib/private/Files/Cache/StorageGlobal.php
+++ b/lib/private/Files/Cache/StorageGlobal.php
@@ -21,16 +21,14 @@
* @package OC\Files\Cache
*/
class StorageGlobal {
- /** @var IDBConnection */
- private $connection;
-
/** @var array */
private $cache = [];
/** @var array */
private $numericIdCache = [];
- public function __construct(IDBConnection $connection) {
- $this->connection = $connection;
+ public function __construct(
+ private IDBConnection $connection,
+ ) {
}
/**
@@ -42,7 +40,7 @@ public function loadForStorageIds(array $storageIds) {
->from('storages')
->where($builder->expr()->in('id', $builder->createNamedParameter(array_values($storageIds), IQueryBuilder::PARAM_STR_ARRAY)));
- $result = $query->execute();
+ $result = $query->executeQuery();
while ($row = $result->fetch()) {
$this->cache[$row['id']] = $row;
}
@@ -60,7 +58,7 @@ public function getStorageInfo(string $storageId): ?array {
->from('storages')
->where($builder->expr()->eq('id', $builder->createNamedParameter($storageId)));
- $result = $query->execute();
+ $result = $query->executeQuery();
$row = $result->fetch();
$result->closeCursor();
@@ -83,7 +81,7 @@ public function getStorageInfoByNumericId(int $numericId): ?array {
->from('storages')
->where($builder->expr()->eq('numeric_id', $builder->createNamedParameter($numericId)));
- $result = $query->execute();
+ $result = $query->executeQuery();
$row = $result->fetch();
$result->closeCursor();
diff --git a/lib/private/Files/Type/Loader.php b/lib/private/Files/Type/Loader.php
index 407df59b2e298..5fbe4139759be 100644
--- a/lib/private/Files/Type/Loader.php
+++ b/lib/private/Files/Type/Loader.php
@@ -21,8 +21,6 @@
class Loader implements IMimeTypeLoader {
use TTransactional;
- private IDBConnection $dbConnection;
-
/** @psalm-var array */
protected array $mimetypes;
@@ -32,8 +30,9 @@ class Loader implements IMimeTypeLoader {
/**
* @param IDBConnection $dbConnection
*/
- public function __construct(IDBConnection $dbConnection) {
- $this->dbConnection = $dbConnection;
+ public function __construct(
+ private IDBConnection $dbConnection,
+ ) {
$this->mimetypes = [];
$this->mimetypeIds = [];
}
@@ -161,6 +160,6 @@ public function updateFilecache(string $ext, int $mimeTypeId): int {
$update->func()->lower('name'),
$update->createNamedParameter('%' . $this->dbConnection->escapeLikeParameter('.' . $ext))
));
- return $update->execute();
+ return $update->executeStatement();
}
}
diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php
index 72cd0ea4a9143..095cbe24316a6 100644
--- a/lib/private/Group/Database.php
+++ b/lib/private/Group/Database.php
@@ -44,15 +44,15 @@ class Database extends ABackend implements
INamedBackend {
/** @var array */
private $groupCache = [];
- private ?IDBConnection $dbConn;
/**
* \OC\Group\Database constructor.
*
* @param IDBConnection|null $dbConn
*/
- public function __construct(?IDBConnection $dbConn = null) {
- $this->dbConn = $dbConn;
+ public function __construct(
+ private ?IDBConnection $dbConn = null,
+ ) {
}
/**
@@ -102,19 +102,19 @@ public function deleteGroup(string $gid): bool {
$qb = $this->dbConn->getQueryBuilder();
$qb->delete('groups')
->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
- ->execute();
+ ->executeStatement();
// Delete the group-user relation
$qb = $this->dbConn->getQueryBuilder();
$qb->delete('group_user')
->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
- ->execute();
+ ->executeStatement();
// Delete the group-groupadmin relation
$qb = $this->dbConn->getQueryBuilder();
$qb->delete('group_admin')
->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
- ->execute();
+ ->executeStatement();
// Delete from cache
unset($this->groupCache[$gid]);
@@ -139,7 +139,7 @@ public function inGroup($uid, $gid) {
->from('group_user')
->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
- ->execute();
+ ->executeQuery();
$result = $cursor->fetch();
$cursor->closeCursor();
@@ -164,7 +164,7 @@ public function addToGroup(string $uid, string $gid): bool {
$qb->insert('group_user')
->setValue('uid', $qb->createNamedParameter($uid))
->setValue('gid', $qb->createNamedParameter($gid))
- ->execute();
+ ->executeStatement();
return true;
} else {
return false;
@@ -186,7 +186,7 @@ public function removeFromGroup(string $uid, string $gid): bool {
$qb->delete('group_user')
->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
->andWhere($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
- ->execute();
+ ->executeStatement();
return true;
}
@@ -213,7 +213,7 @@ public function getUserGroups($uid) {
->from('group_user', 'gu')
->leftJoin('gu', 'groups', 'g', $qb->expr()->eq('gu.gid', 'g.gid'))
->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)))
- ->execute();
+ ->executeQuery();
$groups = [];
while ($row = $cursor->fetch()) {
@@ -260,7 +260,7 @@ public function getGroups(string $search = '', int $limit = -1, int $offset = 0)
if ($offset > 0) {
$query->setFirstResult($offset);
}
- $result = $query->execute();
+ $result = $query->executeQuery();
$groups = [];
while ($row = $result->fetch()) {
@@ -292,7 +292,7 @@ public function groupExists($gid) {
$cursor = $qb->select('gid', 'displayname')
->from('groups')
->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)))
- ->execute();
+ ->executeQuery();
$result = $cursor->fetch();
$cursor->closeCursor();
@@ -423,7 +423,7 @@ public function countUsersInGroup(string $gid, string $search = ''): int {
)));
}
- $result = $query->execute();
+ $result = $query->executeQuery();
$count = $result->fetchOne();
$result->closeCursor();
@@ -455,7 +455,7 @@ public function countDisabledInGroup(string $gid): int {
->andWhere($query->expr()->eq('configvalue', $query->createNamedParameter('false'), IQueryBuilder::PARAM_STR))
->andWhere($query->expr()->eq('gid', $query->createNamedParameter($gid), IQueryBuilder::PARAM_STR));
- $result = $query->execute();
+ $result = $query->executeQuery();
$count = $result->fetchOne();
$result->closeCursor();
@@ -484,7 +484,7 @@ public function getDisplayName(string $gid): string {
->from('groups')
->where($query->expr()->eq('gid', $query->createNamedParameter($gid)));
- $result = $query->execute();
+ $result = $query->executeQuery();
$displayName = $result->fetchOne();
$result->closeCursor();
@@ -555,7 +555,7 @@ public function setDisplayName(string $gid, string $displayName): bool {
$query->update('groups')
->set('displayname', $query->createNamedParameter($displayName))
->where($query->expr()->eq('gid', $query->createNamedParameter($gid)));
- $query->execute();
+ $query->executeStatement();
return true;
}
diff --git a/lib/private/Preview/BackgroundCleanupJob.php b/lib/private/Preview/BackgroundCleanupJob.php
index ad5e793474b91..e816ae2274303 100644
--- a/lib/private/Preview/BackgroundCleanupJob.php
+++ b/lib/private/Preview/BackgroundCleanupJob.php
@@ -18,32 +18,18 @@
use OCP\IDBConnection;
class BackgroundCleanupJob extends TimedJob {
- /** @var IDBConnection */
- private $connection;
- /** @var Root */
- private $previewFolder;
-
- /** @var bool */
- private $isCLI;
-
- /** @var IMimeTypeLoader */
- private $mimeTypeLoader;
-
- public function __construct(ITimeFactory $timeFactory,
- IDBConnection $connection,
- Root $previewFolder,
- IMimeTypeLoader $mimeTypeLoader,
- bool $isCLI) {
+ public function __construct(
+ ITimeFactory $timeFactory,
+ private IDBConnection $connection,
+ private Root $previewFolder,
+ private IMimeTypeLoader $mimeTypeLoader,
+ private bool $isCLI,
+ ) {
parent::__construct($timeFactory);
// Run at most once an hour
$this->setInterval(60 * 60);
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
-
- $this->connection = $connection;
- $this->previewFolder = $previewFolder;
- $this->isCLI = $isCLI;
- $this->mimeTypeLoader = $mimeTypeLoader;
}
public function run($argument) {
@@ -90,7 +76,7 @@ private function getOldPreviewLocations(): \Iterator {
$qb->setMaxResults(10);
}
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
while ($row = $cursor->fetch()) {
yield $row['name'];
@@ -104,7 +90,7 @@ private function getNewPreviewLocations(): \Iterator {
$qb->select('path', 'mimetype')
->from('filecache')
->where($qb->expr()->eq('fileid', $qb->createNamedParameter($this->previewFolder->getId())));
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
$data = $cursor->fetch();
$cursor->closeCursor();
@@ -162,7 +148,7 @@ private function getNewPreviewLocations(): \Iterator {
$qb->setMaxResults(10);
}
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
while ($row = $cursor->fetch()) {
yield $row['name'];
diff --git a/lib/private/Repair/OldGroupMembershipShares.php b/lib/private/Repair/OldGroupMembershipShares.php
index 027f179596c4a..003c15cfb8887 100644
--- a/lib/private/Repair/OldGroupMembershipShares.php
+++ b/lib/private/Repair/OldGroupMembershipShares.php
@@ -14,12 +14,6 @@
use OCP\Share\IShare;
class OldGroupMembershipShares implements IRepairStep {
- /** @var \OCP\IDBConnection */
- protected $connection;
-
- /** @var \OCP\IGroupManager */
- protected $groupManager;
-
/**
* @var array [gid => [uid => (bool)]]
*/
@@ -29,9 +23,10 @@ class OldGroupMembershipShares implements IRepairStep {
* @param IDBConnection $connection
* @param IGroupManager $groupManager
*/
- public function __construct(IDBConnection $connection, IGroupManager $groupManager) {
- $this->connection = $connection;
- $this->groupManager = $groupManager;
+ public function __construct(
+ protected IDBConnection $connection,
+ protected IGroupManager $groupManager,
+ ) {
}
/**
@@ -66,11 +61,11 @@ public function run(IOutput $output) {
$deleteQuery->delete('share')
->where($query->expr()->eq('id', $deleteQuery->createParameter('share')));
- $result = $query->execute();
+ $result = $query->executeQuery();
while ($row = $result->fetch()) {
if (!$this->isMember($row['group'], $row['user'])) {
$deletedEntries += $deleteQuery->setParameter('share', (int)$row['id'])
- ->execute();
+ ->executeStatement();
}
}
$result->closeCursor();
diff --git a/lib/private/Repair/RemoveLinkShares.php b/lib/private/Repair/RemoveLinkShares.php
index 634494acb2f59..a07ebdb72c39e 100644
--- a/lib/private/Repair/RemoveLinkShares.php
+++ b/lib/private/Repair/RemoveLinkShares.php
@@ -19,31 +19,17 @@
use OCP\Notification\IManager;
class RemoveLinkShares implements IRepairStep {
- /** @var IDBConnection */
- private $connection;
- /** @var IConfig */
- private $config;
/** @var string[] */
private $userToNotify = [];
- /** @var IGroupManager */
- private $groupManager;
- /** @var IManager */
- private $notificationManager;
- /** @var ITimeFactory */
- private $timeFactory;
-
- public function __construct(IDBConnection $connection,
- IConfig $config,
- IGroupManager $groupManager,
- IManager $notificationManager,
- ITimeFactory $timeFactory) {
- $this->connection = $connection;
- $this->config = $config;
- $this->groupManager = $groupManager;
- $this->notificationManager = $notificationManager;
- $this->timeFactory = $timeFactory;
- }
+ public function __construct(
+ private IDBConnection $connection,
+ private IConfig $config,
+ private IGroupManager $groupManager,
+ private IManager $notificationManager,
+ private ITimeFactory $timeFactory,
+ ) {
+ }
public function getName(): string {
return 'Remove potentially over exposing share links';
@@ -74,7 +60,7 @@ private function deleteShare(int $id): void {
$qb = $this->connection->getQueryBuilder();
$qb->delete('share')
->where($qb->expr()->eq('id', $qb->createNamedParameter($id)));
- $qb->execute();
+ $qb->executeStatement();
}
/**
@@ -107,7 +93,7 @@ private function getTotal(): int {
->from('share')
->where($query->expr()->in('id', $query->createFunction($subQuery->getSQL())));
- $result = $query->execute();
+ $result = $query->executeQuery();
$data = $result->fetch();
$result->closeCursor();
@@ -137,7 +123,7 @@ private function getShares(): IResult {
))
->andWhere($query->expr()->eq('s1.item_source', 's2.item_source'));
/** @var IResult $result */
- $result = $query->execute();
+ $result = $query->executeQuery();
return $result;
}
diff --git a/lib/private/Repair/RepairInvalidShares.php b/lib/private/Repair/RepairInvalidShares.php
index 71e6359da5b54..9553f25ee70e7 100644
--- a/lib/private/Repair/RepairInvalidShares.php
+++ b/lib/private/Repair/RepairInvalidShares.php
@@ -7,6 +7,8 @@
*/
namespace OC\Repair;
+use OCP\IConfig;
+use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
@@ -16,19 +18,10 @@
class RepairInvalidShares implements IRepairStep {
public const CHUNK_SIZE = 200;
- /** @var \OCP\IConfig */
- protected $config;
-
- /** @var \OCP\IDBConnection */
- protected $connection;
-
- /**
- * @param \OCP\IConfig $config
- * @param \OCP\IDBConnection $connection
- */
- public function __construct($config, $connection) {
- $this->connection = $connection;
- $this->config = $config;
+ public function __construct(
+ protected IConfig $config,
+ protected IDBConnection $connection,
+ ) {
}
public function getName() {
@@ -49,7 +42,7 @@ private function adjustFileSharePermissions(IOutput $out) {
->where($builder->expr()->eq('item_type', $builder->expr()->literal('file')))
->andWhere($builder->expr()->neq('permissions', $permsFunc));
- $updatedEntries = $builder->execute();
+ $updatedEntries = $builder->executeStatement();
if ($updatedEntries > 0) {
$out->info('Fixed file share permissions for ' . $updatedEntries . ' shares');
}
@@ -77,11 +70,11 @@ private function removeSharesNonExistingParent(IOutput $out) {
$deletedInLastChunk = self::CHUNK_SIZE;
while ($deletedInLastChunk === self::CHUNK_SIZE) {
$deletedInLastChunk = 0;
- $result = $query->execute();
+ $result = $query->executeQuery();
while ($row = $result->fetch()) {
$deletedInLastChunk++;
$deletedEntries += $deleteQuery->setParameter('parent', (int)$row['parent'])
- ->execute();
+ ->executeStatement();
}
$result->closeCursor();
}
diff --git a/lib/private/Security/Bruteforce/CleanupJob.php b/lib/private/Security/Bruteforce/CleanupJob.php
index fdf7fb97d3188..f07e4dbacbdda 100644
--- a/lib/private/Security/Bruteforce/CleanupJob.php
+++ b/lib/private/Security/Bruteforce/CleanupJob.php
@@ -32,6 +32,6 @@ protected function run($argument): void {
$qb = $this->connection->getQueryBuilder();
$qb->delete('bruteforce_attempts')
->where($qb->expr()->lt('occurred', $qb->createNamedParameter($time), IQueryBuilder::PARAM_INT));
- $qb->execute();
+ $qb->executeStatement();
}
}
diff --git a/lib/private/SubAdmin.php b/lib/private/SubAdmin.php
index 335e901a321b6..90756e2d3fdc6 100644
--- a/lib/private/SubAdmin.php
+++ b/lib/private/SubAdmin.php
@@ -19,32 +19,12 @@
use OCP\IUserManager;
class SubAdmin extends PublicEmitter implements ISubAdmin {
- /** @var IUserManager */
- private $userManager;
-
- /** @var IGroupManager */
- private $groupManager;
-
- /** @var IDBConnection */
- private $dbConn;
-
- /** @var IEventDispatcher */
- private $eventDispatcher;
-
- /**
- * @param IUserManager $userManager
- * @param IGroupManager $groupManager
- * @param IDBConnection $dbConn
- */
- public function __construct(IUserManager $userManager,
- IGroupManager $groupManager,
- IDBConnection $dbConn,
- IEventDispatcher $eventDispatcher) {
- $this->userManager = $userManager;
- $this->groupManager = $groupManager;
- $this->dbConn = $dbConn;
- $this->eventDispatcher = $eventDispatcher;
-
+ public function __construct(
+ private IUserManager $userManager,
+ private IGroupManager $groupManager,
+ private IDBConnection $dbConn,
+ private IEventDispatcher $eventDispatcher,
+ ) {
$this->userManager->listen('\OC\User', 'postDelete', function ($user) {
$this->post_deleteUser($user);
});
@@ -66,7 +46,7 @@ public function createSubAdmin(IUser $user, IGroup $group): void {
'gid' => $qb->createNamedParameter($group->getGID()),
'uid' => $qb->createNamedParameter($user->getUID())
])
- ->execute();
+ ->executeStatement();
/** @deprecated 21.0.0 - use type SubAdminAddedEvent instead */
$this->emit('\OC\SubAdmin', 'postCreateSubAdmin', [$user, $group]);
@@ -85,7 +65,7 @@ public function deleteSubAdmin(IUser $user, IGroup $group): void {
$qb->delete('group_admin')
->where($qb->expr()->eq('gid', $qb->createNamedParameter($group->getGID())))
->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID())))
- ->execute();
+ ->executeStatement();
/** @deprecated 21.0.0 - use type SubAdminRemovedEvent instead */
$this->emit('\OC\SubAdmin', 'postDeleteSubAdmin', [$user, $group]);
@@ -123,7 +103,7 @@ public function getSubAdminsGroupIds(IUser $user): array {
$result = $qb->select('gid')
->from('group_admin')
->where($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID())))
- ->execute();
+ ->executeQuery();
$groups = [];
while ($row = $result->fetch()) {
@@ -156,7 +136,7 @@ public function getGroupsSubAdmins(IGroup $group): array {
$result = $qb->select('uid')
->from('group_admin')
->where($qb->expr()->eq('gid', $qb->createNamedParameter($group->getGID())))
- ->execute();
+ ->executeQuery();
$users = [];
while ($row = $result->fetch()) {
@@ -179,7 +159,7 @@ public function getAllSubAdmins(): array {
$result = $qb->select('*')
->from('group_admin')
- ->execute();
+ ->executeQuery();
$subadmins = [];
while ($row = $result->fetch()) {
@@ -213,7 +193,7 @@ public function isSubAdminOfGroup(IUser $user, IGroup $group): bool {
->from('group_admin')
->where($qb->expr()->eq('gid', $qb->createNamedParameter($group->getGID())))
->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID())))
- ->execute();
+ ->executeQuery();
$fetch = $result->fetch();
$result->closeCursor();
@@ -244,7 +224,7 @@ public function isSubAdmin(IUser $user): bool {
->from('group_admin')
->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID())))
->setMaxResults(1)
- ->execute();
+ ->executeQuery();
$isSubAdmin = $result->fetch();
$result->closeCursor();
@@ -284,7 +264,7 @@ private function post_deleteUser(IUser $user) {
$qb->delete('group_admin')
->where($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID())))
- ->execute();
+ ->executeStatement();
}
/**
@@ -296,6 +276,6 @@ private function post_deleteGroup(IGroup $group) {
$qb->delete('group_admin')
->where($qb->expr()->eq('gid', $qb->createNamedParameter($group->getGID())))
- ->execute();
+ ->executeStatement();
}
}
diff --git a/lib/private/Updater/ChangesMapper.php b/lib/private/Updater/ChangesMapper.php
index 5583cf5a1a606..c399948ff10fe 100644
--- a/lib/private/Updater/ChangesMapper.php
+++ b/lib/private/Updater/ChangesMapper.php
@@ -32,7 +32,7 @@ public function getChanges(string $version): Changes {
$result = $qb->select('*')
->from(self::TABLE_NAME)
->where($qb->expr()->eq('version', $qb->createNamedParameter($version)))
- ->execute();
+ ->executeQuery();
$data = $result->fetch();
$result->closeCursor();