aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>2024-10-16 10:41:21 +0200
committerGit'Fellow <12234510+solracsf@users.noreply.github.com>2024-10-17 09:21:07 +0200
commitc254855222ca2776ccaa9c362b84295391cdd208 (patch)
tree0209b59a3dff7bd3a50629dfb6c8376e02dc43af /lib
parent4100f583f03464978e622f5765bbef33e363c97f (diff)
downloadnextcloud-server-c254855222ca2776ccaa9c362b84295391cdd208.tar.gz
nextcloud-server-c254855222ca2776ccaa9c362b84295391cdd208.zip
chore(db): Correctly apply query types
fix: psalm fix: error fix: add batch fix: fatal error fix: add batch chore: add batch chore: add batch fix: psalm fix: typo fix: psalm fix: return bool fix: revert Manager
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Accounts/AccountManager.php4
-rw-r--r--lib/private/Authentication/Token/PublicKeyTokenMapper.php14
-rw-r--r--lib/private/Files/Cache/Propagator.php5
-rw-r--r--lib/private/Files/Cache/StorageGlobal.php14
-rw-r--r--lib/private/Files/Type/Loader.php9
-rw-r--r--lib/private/Group/Database.php32
-rw-r--r--lib/private/Preview/BackgroundCleanupJob.php34
-rw-r--r--lib/private/Repair/OldGroupMembershipShares.php17
-rw-r--r--lib/private/Repair/RemoveLinkShares.php36
-rw-r--r--lib/private/Repair/RepairInvalidShares.php25
-rw-r--r--lib/private/Security/Bruteforce/CleanupJob.php2
-rw-r--r--lib/private/SubAdmin.php50
-rw-r--r--lib/private/Updater/ChangesMapper.php2
13 files changed, 90 insertions, 154 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index 2ab2beb6d3e..0d091786cd6 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -243,7 +243,7 @@ class AccountManager implements IAccountManager {
$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 @@ class AccountManager implements IAccountManager {
$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 b1341fe1898..9aabd69e57a 100644
--- a/lib/private/Authentication/Token/PublicKeyTokenMapper.php
+++ b/lib/private/Authentication/Token/PublicKeyTokenMapper.php
@@ -31,7 +31,7 @@ class PublicKeyTokenMapper extends QBMapper {
$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 @@ class PublicKeyTokenMapper extends QBMapper {
->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 @@ class PublicKeyTokenMapper extends QBMapper {
->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 @@ class PublicKeyTokenMapper extends QBMapper {
->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 @@ class PublicKeyTokenMapper extends QBMapper {
$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 @@ class PublicKeyTokenMapper extends QBMapper {
->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 @@ class PublicKeyTokenMapper extends QBMapper {
->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 bbeb8c42075..cdf9ca9991a 100644
--- a/lib/private/Files/Cache/Propagator.php
+++ b/lib/private/Files/Cache/Propagator.php
@@ -45,7 +45,6 @@ class Propagator implements IPropagator {
$this->ignore = $ignore;
}
-
/**
* @param string $internalPath
* @param int $time
@@ -200,13 +199,13 @@ class Propagator implements IPropagator {
$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 b55c0fcdb91..bab31b1db91 100644
--- a/lib/private/Files/Cache/StorageGlobal.php
+++ b/lib/private/Files/Cache/StorageGlobal.php
@@ -21,16 +21,14 @@ use OCP\IDBConnection;
* @package OC\Files\Cache
*/
class StorageGlobal {
- /** @var IDBConnection */
- private $connection;
-
/** @var array<string, array> */
private $cache = [];
/** @var array<int, array> */
private $numericIdCache = [];
- public function __construct(IDBConnection $connection) {
- $this->connection = $connection;
+ public function __construct(
+ private IDBConnection $connection,
+ ) {
}
/**
@@ -42,7 +40,7 @@ class StorageGlobal {
->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 @@ class StorageGlobal {
->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 @@ class StorageGlobal {
->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 407df59b2e2..5fbe4139759 100644
--- a/lib/private/Files/Type/Loader.php
+++ b/lib/private/Files/Type/Loader.php
@@ -21,8 +21,6 @@ use OCP\IDBConnection;
class Loader implements IMimeTypeLoader {
use TTransactional;
- private IDBConnection $dbConnection;
-
/** @psalm-var array<int, string> */
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 @@ class Loader implements IMimeTypeLoader {
$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 72cd0ea4a91..095cbe24316 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<string, array{gid: string, displayname: string}> */
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 @@ class Database extends ABackend implements
$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 @@ class Database extends ABackend implements
->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 @@ class Database extends ABackend implements
$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 @@ class Database extends ABackend implements
$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 @@ class Database extends ABackend implements
->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 @@ class Database extends ABackend implements
if ($offset > 0) {
$query->setFirstResult($offset);
}
- $result = $query->execute();
+ $result = $query->executeQuery();
$groups = [];
while ($row = $result->fetch()) {
@@ -292,7 +292,7 @@ class Database extends ABackend implements
$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 @@ class Database extends ABackend implements
)));
}
- $result = $query->execute();
+ $result = $query->executeQuery();
$count = $result->fetchOne();
$result->closeCursor();
@@ -455,7 +455,7 @@ class Database extends ABackend implements
->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 @@ class Database extends ABackend implements
->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 @@ class Database extends ABackend implements
$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 ad5e793474b..e816ae22743 100644
--- a/lib/private/Preview/BackgroundCleanupJob.php
+++ b/lib/private/Preview/BackgroundCleanupJob.php
@@ -18,32 +18,18 @@ use OCP\Files\NotPermittedException;
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 @@ class BackgroundCleanupJob extends TimedJob {
$qb->setMaxResults(10);
}
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
while ($row = $cursor->fetch()) {
yield $row['name'];
@@ -104,7 +90,7 @@ class BackgroundCleanupJob extends TimedJob {
$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 @@ class BackgroundCleanupJob extends TimedJob {
$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 027f179596c..003c15cfb88 100644
--- a/lib/private/Repair/OldGroupMembershipShares.php
+++ b/lib/private/Repair/OldGroupMembershipShares.php
@@ -14,12 +14,6 @@ use OCP\Migration\IRepairStep;
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 @@ class OldGroupMembershipShares implements IRepairStep {
$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 634494acb2f..a07ebdb72c3 100644
--- a/lib/private/Repair/RemoveLinkShares.php
+++ b/lib/private/Repair/RemoveLinkShares.php
@@ -19,31 +19,17 @@ use OCP\Migration\IRepairStep;
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 @@ class RemoveLinkShares implements IRepairStep {
$qb = $this->connection->getQueryBuilder();
$qb->delete('share')
->where($qb->expr()->eq('id', $qb->createNamedParameter($id)));
- $qb->execute();
+ $qb->executeStatement();
}
/**
@@ -107,7 +93,7 @@ class RemoveLinkShares implements IRepairStep {
->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 @@ class RemoveLinkShares implements IRepairStep {
))
->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 71e6359da5b..9553f25ee70 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 @@ use OCP\Migration\IRepairStep;
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 @@ class RepairInvalidShares implements IRepairStep {
->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 @@ class RepairInvalidShares implements IRepairStep {
$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 fdf7fb97d31..f07e4dbacbd 100644
--- a/lib/private/Security/Bruteforce/CleanupJob.php
+++ b/lib/private/Security/Bruteforce/CleanupJob.php
@@ -32,6 +32,6 @@ class CleanupJob extends TimedJob {
$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 335e901a321..90756e2d3fd 100644
--- a/lib/private/SubAdmin.php
+++ b/lib/private/SubAdmin.php
@@ -19,32 +19,12 @@ use OCP\IUser;
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 @@ class SubAdmin extends PublicEmitter implements ISubAdmin {
'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 @@ class SubAdmin extends PublicEmitter implements ISubAdmin {
$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 @@ class SubAdmin extends PublicEmitter implements ISubAdmin {
$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 @@ class SubAdmin extends PublicEmitter implements ISubAdmin {
$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 @@ class SubAdmin extends PublicEmitter implements ISubAdmin {
$result = $qb->select('*')
->from('group_admin')
- ->execute();
+ ->executeQuery();
$subadmins = [];
while ($row = $result->fetch()) {
@@ -213,7 +193,7 @@ class SubAdmin extends PublicEmitter implements ISubAdmin {
->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 @@ class SubAdmin extends PublicEmitter implements ISubAdmin {
->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 @@ class SubAdmin extends PublicEmitter implements ISubAdmin {
$qb->delete('group_admin')
->where($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID())))
- ->execute();
+ ->executeStatement();
}
/**
@@ -296,6 +276,6 @@ class SubAdmin extends PublicEmitter implements ISubAdmin {
$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 5583cf5a1a6..c399948ff10 100644
--- a/lib/private/Updater/ChangesMapper.php
+++ b/lib/private/Updater/ChangesMapper.php
@@ -32,7 +32,7 @@ class ChangesMapper extends QBMapper {
$result = $qb->select('*')
->from(self::TABLE_NAME)
->where($qb->expr()->eq('version', $qb->createNamedParameter($version)))
- ->execute();
+ ->executeQuery();
$data = $result->fetch();
$result->closeCursor();