Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable22] Cast orphan subscription id to int #30930

Merged
merged 1 commit into from
Jan 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep {
/** @var int */
private $progress = 0;

private $orphanSubscriptions = [];
/** @var int[] */
private $orphanSubscriptionIds = [];

private const SUBSCRIPTIONS_CHUNK_SIZE = 1000;

Expand Down Expand Up @@ -74,7 +75,7 @@ public function run(IOutput $output) {
$output->finishProgress();
$this->deleteOrphanSubscriptions();

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

/**
Expand Down Expand Up @@ -112,7 +113,7 @@ private function checkSubscriptions(): void {
while ($row = $result->fetch()) {
$username = $this->getPrincipal($row['principaluri']);
if (!$this->userManager->userExists($username)) {
$this->orphanSubscriptions[] = $row['id'];
$this->orphanSubscriptionIds[] = (int) $row['id'];
}
}
$result->closeCursor();
Expand All @@ -122,7 +123,7 @@ private function checkSubscriptions(): void {
* @throws Exception
*/
private function deleteOrphanSubscriptions(): void {
foreach ($this->orphanSubscriptions as $orphanSubscriptionID) {
foreach ($this->orphanSubscriptionIds as $orphanSubscriptionID) {
$this->deleteOrphanSubscription($orphanSubscriptionID);
}
}
Expand Down