Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php')
-rw-r--r--apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php
index dbc6267eb3a..9c0334aa2f3 100644
--- a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php
+++ b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php
@@ -36,11 +36,12 @@ use OCP\IUser;
use OCP\UserMigration\IExportDestination;
use OCP\UserMigration\IImportSource;
use OCP\UserMigration\IMigrator;
+use OCP\UserMigration\ISizeEstimationMigrator;
use OCP\UserMigration\TMigratorBasicVersionHandling;
use OCP\UserMigration\UserMigrationException;
use Symfony\Component\Console\Output\OutputInterface;
-class TrashbinMigrator implements IMigrator {
+class TrashbinMigrator implements IMigrator, ISizeEstimationMigrator {
use TMigratorBasicVersionHandling;
@@ -66,6 +67,23 @@ class TrashbinMigrator implements IMigrator {
/**
* {@inheritDoc}
*/
+ public function getEstimatedExportSize(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 . '…');