]> source.dussan.org Git - nextcloud-server.git/commitdiff
Cast orphan subscription id to int 30930/head
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Wed, 1 Dec 2021 09:48:14 +0000 (10:48 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Mon, 31 Jan 2022 09:24:19 +0000 (09:24 +0000)
DB columns are of type int by default, so they need to be casted.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
apps/dav/lib/Migration/RemoveDeletedUsersCalendarSubscriptions.php

index 50becf81e78f1704708222ff03c73e1c40041526..38d395b2c81e0fe93f3faaa9dbd9b7e33c9b3a6b 100644 (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);
                }
        }