Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions apps/dav/lib/UserMigration/CalendarMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private function getUniqueCalendarUri(IUser $user, string $initialCalendarUri):
/**
* {@inheritDoc}
*/
public function getEstimatedExportSize(IUser $user): int {
public function getEstimatedExportSize(IUser $user): int|float {
$calendarExports = $this->getCalendarExports($user, new NullOutput());
$calendarCount = count($calendarExports);

Expand All @@ -230,7 +230,7 @@ function (array $data): int {
// 450B for each component (events, todos, alarms, etc.)
$size += ($componentCount * 450) / 1024;

return (int)ceil($size);
return ceil($size);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/lib/UserMigration/ContactsMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private function serializeCards(array $vCards): string {
/**
* {@inheritDoc}
*/
public function getEstimatedExportSize(IUser $user): int {
public function getEstimatedExportSize(IUser $user): int|float {
$addressBookExports = $this->getAddressBookExports($user, new NullOutput());
$addressBookCount = count($addressBookExports);

Expand All @@ -217,7 +217,7 @@ public function getEstimatedExportSize(IUser $user): int {
// 350B for each contact
$size += ($contactsCount * 350) / 1024;

return (int)ceil($size);
return ceil($size);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ public function __construct(
/**
* {@inheritDoc}
*/
public function getEstimatedExportSize(IUser $user): int {
public function getEstimatedExportSize(IUser $user): int|float {
$uid = $user->getUID();

try {
$trashbinFolder = $this->root->get('/'.$uid.'/files_trashbin');
if (!$trashbinFolder instanceof Folder) {
return 0;
}
return (int)ceil($trashbinFolder->getSize() / 1024);
return ceil($trashbinFolder->getSize() / 1024);
} catch (\Throwable $e) {
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/settings/lib/UserMigration/AccountMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function __construct(
/**
* {@inheritDoc}
*/
public function getEstimatedExportSize(IUser $user): int {
public function getEstimatedExportSize(IUser $user): int|float {
$size = 100; // 100KiB for account JSON

try {
Expand All @@ -97,7 +97,7 @@ public function getEstimatedExportSize(IUser $user): int {
// Skip avatar in size estimate on failure
}

return (int)ceil($size);
return ceil($size);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion lib/public/UserMigration/ISizeEstimationMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}