diff options
Diffstat (limited to 'lib/private/Repair')
-rw-r--r-- | lib/private/Repair/OldGroupMembershipShares.php | 17 | ||||
-rw-r--r-- | lib/private/Repair/RemoveLinkShares.php | 36 | ||||
-rw-r--r-- | lib/private/Repair/RepairInvalidShares.php | 25 |
3 files changed, 26 insertions, 52 deletions
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(); } |