summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-04-28 11:47:04 +0200
committerCôme Chilliet (Rebase PR Action) <come-nc@users.noreply.github.com>2022-05-30 07:36:13 +0000
commit09917b85838d6cf8f075eadfac65a674be2c4316 (patch)
tree9bf1a7c7ca34b59ca1f9e7ac6b2f5bdad83be623 /apps/files_trashbin/lib
parentf20b7e576484d9d7654763e60707115d93655df9 (diff)
downloadnextcloud-server-09917b85838d6cf8f075eadfac65a674be2c4316.tar.gz
nextcloud-server-09917b85838d6cf8f075eadfac65a674be2c4316.zip
Implement getExportEstimatedSize in migrators
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/files_trashbin/lib')
-rw-r--r--apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php17
1 files changed, 17 insertions, 0 deletions
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
@@ -66,6 +66,23 @@ class TrashbinMigrator implements IMigrator {
/**
* {@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}
+ */
public function export(IUser $user, IExportDestination $exportDestination, OutputInterface $output): void {
$output->writeln('Exporting trashbin into ' . Application::APP_ID . '…');