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
path: root/apps/dav
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-04-28 12:47:04 +0300
committerCôme Chilliet (Rebase PR Action) <come-nc@users.noreply.github.com>2022-05-30 10:36:13 +0300
commit09917b85838d6cf8f075eadfac65a674be2c4316 (patch)
tree9bf1a7c7ca34b59ca1f9e7ac6b2f5bdad83be623 /apps/dav
parentf20b7e576484d9d7654763e60707115d93655df9 (diff)
Implement getExportEstimatedSize in migrators
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/UserMigration/CalendarMigrator.php15
-rw-r--r--apps/dav/lib/UserMigration/ContactsMigrator.php15
2 files changed, 30 insertions, 0 deletions
diff --git a/apps/dav/lib/UserMigration/CalendarMigrator.php b/apps/dav/lib/UserMigration/CalendarMigrator.php
index 015ce6faa86..e6383bcc1dd 100644
--- a/apps/dav/lib/UserMigration/CalendarMigrator.php
+++ b/apps/dav/lib/UserMigration/CalendarMigrator.php
@@ -209,6 +209,21 @@ class CalendarMigrator implements IMigrator {
/**
* {@inheritDoc}
*/
+ public function getExportEstimatedSize(IUser $user): int {
+ $principalUri = $this->getPrincipalUri($user);
+
+ return array_sum(array_map(
+ function (ICalendar $calendar) use ($user): int {
+ // FIXME 1MiB by calendar, no idea if this is accurate and if we should go into more details
+ return 1000;
+ },
+ $this->calendarManager->getCalendarsForPrincipal($principalUri),
+ ));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public function export(IUser $user, IExportDestination $exportDestination, OutputInterface $output): void {
$output->writeln('Exporting calendars into ' . CalendarMigrator::EXPORT_ROOT . '…');
diff --git a/apps/dav/lib/UserMigration/ContactsMigrator.php b/apps/dav/lib/UserMigration/ContactsMigrator.php
index aed41e5c82f..068500a1ba7 100644
--- a/apps/dav/lib/UserMigration/ContactsMigrator.php
+++ b/apps/dav/lib/UserMigration/ContactsMigrator.php
@@ -196,6 +196,21 @@ class ContactsMigrator implements IMigrator {
/**
* {@inheritDoc}
*/
+ public function getExportEstimatedSize(IUser $user): int {
+ $principalUri = $this->getPrincipalUri($user);
+
+ return array_sum(array_map(
+ function (array $addressBookInfo) use ($user): int {
+ // FIXME 1MiB by addressbook, no idea if this is accurate and if we should go into more details
+ return 1000;
+ },
+ $this->cardDavBackend->getAddressBooksForUser($principalUri),
+ ));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public function export(IUser $user, IExportDestination $exportDestination, OutputInterface $output): void {
$output->writeln('Exporting contacts into ' . ContactsMigrator::PATH_ROOT . '…');