aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Repair/OldGroupMembershipShares.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Repair/OldGroupMembershipShares.php')
-rw-r--r--lib/private/Repair/OldGroupMembershipShares.php48
1 files changed, 14 insertions, 34 deletions
diff --git a/lib/private/Repair/OldGroupMembershipShares.php b/lib/private/Repair/OldGroupMembershipShares.php
index be507debbd9..003c15cfb88 100644
--- a/lib/private/Repair/OldGroupMembershipShares.php
+++ b/lib/private/Repair/OldGroupMembershipShares.php
@@ -1,24 +1,9 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Joas Schilling <coding@schilljs.com>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OC\Repair;
@@ -29,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)]]
*/
@@ -44,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,
+ ) {
}
/**
@@ -72,20 +52,20 @@ class OldGroupMembershipShares implements IRepairStep {
->from('share', 's1')
->where($query->expr()->isNotNull('s1.parent'))
// \OC\Share\Constant::$shareTypeGroupUserUnique === 2
- ->andWhere($query->expr()->eq('s1.share_type', $query->expr()->literal(2)))
- ->andWhere($query->expr()->isNotNull('s2.id'))
- ->andWhere($query->expr()->eq('s2.share_type', $query->expr()->literal(IShare::TYPE_GROUP)))
+ ->andWhere($query->expr()->eq('s1.share_type', $query->expr()->literal(2)))
+ ->andWhere($query->expr()->isNotNull('s2.id'))
+ ->andWhere($query->expr()->eq('s2.share_type', $query->expr()->literal(IShare::TYPE_GROUP)))
->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id'));
$deleteQuery = $this->connection->getQueryBuilder();
$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();
+ $deletedEntries += $deleteQuery->setParameter('share', (int)$row['id'])
+ ->executeStatement();
}
}
$result->closeCursor();