Skip to content

Commit b2b1feb

Browse files
Merge pull request #30008 from nextcloud/backport/30001/stable23
[stable23] Cast orphan subscription id to int
2 parents 4caad84 + ea450f1 commit b2b1feb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep {
4141
/** @var int */
4242
private $progress = 0;
4343

44-
private $orphanSubscriptions = [];
44+
/** @var int[] */
45+
private $orphanSubscriptionIds = [];
4546

4647
private const SUBSCRIPTIONS_CHUNK_SIZE = 1000;
4748

@@ -74,7 +75,7 @@ public function run(IOutput $output) {
7475
$output->finishProgress();
7576
$this->deleteOrphanSubscriptions();
7677

77-
$output->info(sprintf('%d calendar subscriptions without an user have been cleaned up', count($this->orphanSubscriptions)));
78+
$output->info(sprintf('%d calendar subscriptions without an user have been cleaned up', count($this->orphanSubscriptionIds)));
7879
}
7980

8081
/**
@@ -112,7 +113,7 @@ private function checkSubscriptions(): void {
112113
while ($row = $result->fetch()) {
113114
$username = $this->getPrincipal($row['principaluri']);
114115
if (!$this->userManager->userExists($username)) {
115-
$this->orphanSubscriptions[] = $row['id'];
116+
$this->orphanSubscriptionIds[] = (int) $row['id'];
116117
}
117118
}
118119
$result->closeCursor();
@@ -122,7 +123,7 @@ private function checkSubscriptions(): void {
122123
* @throws Exception
123124
*/
124125
private function deleteOrphanSubscriptions(): void {
125-
foreach ($this->orphanSubscriptions as $orphanSubscriptionID) {
126+
foreach ($this->orphanSubscriptionIds as $orphanSubscriptionID) {
126127
$this->deleteOrphanSubscription($orphanSubscriptionID);
127128
}
128129
}

0 commit comments

Comments
 (0)