From 09917b85838d6cf8f075eadfac65a674be2c4316 Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Thu, 28 Apr 2022 11:47:04 +0200 Subject: Implement getExportEstimatedSize in migrators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- .../lib/UserMigration/TrashbinMigrator.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'apps/files_trashbin/lib') diff --git a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php index dbc6267eb3a..721ca59f929 100644 --- a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php +++ b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php @@ -63,6 +63,23 @@ class TrashbinMigrator implements IMigrator { $this->l10n = $l10n; } + /** + * {@inheritDoc} + */ + public function getExportEstimatedSize(IUser $user): int { + $uid = $user->getUID(); + + try { + $trashbinFolder = $this->root->get('/'.$uid.'/files_trashbin'); + if (!$trashbinFolder instanceof Folder) { + return 0; + } + return (int)ceil($trashbinFolder->getSize() / 1024); + } catch (\Throwable $e) { + return 0; + } + } + /** * {@inheritDoc} */ -- cgit v1.2.3