]> source.dussan.org Git - nextcloud-server.git/commitdiff
feat(UserMigration)!: 32-bit support 38104/head
authorChristopher Ng <chrng8@gmail.com>
Sat, 6 May 2023 00:59:57 +0000 (17:59 -0700)
committerChristopher Ng <chrng8@gmail.com>
Sat, 6 May 2023 00:59:57 +0000 (17:59 -0700)
Signed-off-by: Christopher Ng <chrng8@gmail.com>
apps/dav/lib/UserMigration/CalendarMigrator.php
apps/dav/lib/UserMigration/ContactsMigrator.php
apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php
apps/settings/lib/UserMigration/AccountMigrator.php
lib/public/UserMigration/ISizeEstimationMigrator.php

index 057f7dce77d81e785425cefd9be51180ab014a66..e5b404e785f961349e22acffd6f401658e368726 100644 (file)
@@ -211,7 +211,7 @@ class CalendarMigrator implements IMigrator, ISizeEstimationMigrator {
        /**
         * {@inheritDoc}
         */
-       public function getEstimatedExportSize(IUser $user): int {
+       public function getEstimatedExportSize(IUser $user): int|float {
                $calendarExports = $this->getCalendarExports($user, new NullOutput());
                $calendarCount = count($calendarExports);
 
@@ -230,7 +230,7 @@ class CalendarMigrator implements IMigrator, ISizeEstimationMigrator {
                // 450B for each component (events, todos, alarms, etc.)
                $size += ($componentCount * 450) / 1024;
 
-               return (int)ceil($size);
+               return ceil($size);
        }
 
        /**
index 196d0a6110a8f8854ade1a0fc048d0680c04cee8..58e267ab28c155be86e1b4976ce818eeda6236de 100644 (file)
@@ -202,7 +202,7 @@ class ContactsMigrator implements IMigrator, ISizeEstimationMigrator {
        /**
         * {@inheritDoc}
         */
-       public function getEstimatedExportSize(IUser $user): int {
+       public function getEstimatedExportSize(IUser $user): int|float {
                $addressBookExports = $this->getAddressBookExports($user, new NullOutput());
                $addressBookCount = count($addressBookExports);
 
@@ -217,7 +217,7 @@ class ContactsMigrator implements IMigrator, ISizeEstimationMigrator {
                // 350B for each contact
                $size += ($contactsCount * 350) / 1024;
 
-               return (int)ceil($size);
+               return ceil($size);
        }
 
        /**
index 70338a469d3a79365aa5c43ceb8899200ad94090..842721eeac9a2f06273d8d576f996a2f6c45aab5 100644 (file)
@@ -67,7 +67,7 @@ class TrashbinMigrator implements IMigrator, ISizeEstimationMigrator {
        /**
         * {@inheritDoc}
         */
-       public function getEstimatedExportSize(IUser $user): int {
+       public function getEstimatedExportSize(IUser $user): int|float {
                $uid = $user->getUID();
 
                try {
@@ -75,7 +75,7 @@ class TrashbinMigrator implements IMigrator, ISizeEstimationMigrator {
                        if (!$trashbinFolder instanceof Folder) {
                                return 0;
                        }
-                       return (int)ceil($trashbinFolder->getSize() / 1024);
+                       return ceil($trashbinFolder->getSize() / 1024);
                } catch (\Throwable $e) {
                        return 0;
                }
index e8c706242242e7112cd1ec42e5c4d51b7df9c10d..a779ad76c8d5ae6a802c32c2d51b52acfc7f4916 100644 (file)
@@ -84,7 +84,7 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator {
        /**
         * {@inheritDoc}
         */
-       public function getEstimatedExportSize(IUser $user): int {
+       public function getEstimatedExportSize(IUser $user): int|float {
                $size = 100; // 100KiB for account JSON
 
                try {
@@ -97,7 +97,7 @@ class AccountMigrator implements IMigrator, ISizeEstimationMigrator {
                        // Skip avatar in size estimate on failure
                }
 
-               return (int)ceil($size);
+               return ceil($size);
        }
 
        /**
index 05abe48ea8f8d3ae8a127e8784077cca589e531e..46664bd7390b69fed2e443a2e5a20364caf435e1 100644 (file)
@@ -38,6 +38,7 @@ interface ISizeEstimationMigrator {
         * Should be fast, favor performance over accuracy.
         *
         * @since 25.0.0
+        * @since 27.0.0 return value may overflow from int to float
         */
-       public function getEstimatedExportSize(IUser $user): int;
+       public function getEstimatedExportSize(IUser $user): int|float;
 }