Cast orphan subscription id to int

DB columns are of type int by default, so they need to be casted.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2021-12-01 10:48:14 +01:00
parent dcec9fef73
commit 478953d002
No known key found for this signature in database
GPG key ID: CC42AC2A7F0E56D8

View file

@ -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;
@ -74,7 +75,7 @@ class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep {
$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)));
}
/**
@ -112,7 +113,7 @@ class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep {
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();
@ -122,7 +123,7 @@ class RemoveDeletedUsersCalendarSubscriptions implements IRepairStep {
* @throws Exception
*/
private function deleteOrphanSubscriptions(): void {
foreach ($this->orphanSubscriptions as $orphanSubscriptionID) {
foreach ($this->orphanSubscriptionIds as $orphanSubscriptionID) {
$this->deleteOrphanSubscription($orphanSubscriptionID);
}
}