Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Subtract size of export file from estimate
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal committed Jun 2, 2022
commit e7d0badc450cfd252dd0a12a7b7470e2973f4124
11 changes: 11 additions & 0 deletions lib/Migrator/FilesMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ public function getEstimatedExportSize(IUser $user): int {

$size = $userFolder->getSize() / 1024;

try {
$exportFile = $userFolder->get(ExportDestination::EXPORT_FILENAME);
if (!($exportFile instanceof File)) {
throw new \InvalidArgumentException('User export is not a file');
}

$size -= $exportFile->getSize() / 1024;
} catch (NotFoundException $e) {
// No size subtraction needed if export file doesn't exist
}

try {
$versionsFolder = $this->root->get('/'.$uid.'/'.FilesVersionsStorage::VERSIONS_ROOT);
if ($versionsFolder instanceof Folder) {
Expand Down