IMigrator.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\UserMigration;
  8. use OCP\IUser;
  9. use Symfony\Component\Console\Output\OutputInterface;
  10. /**
  11. * @since 24.0.0
  12. */
  13. interface IMigrator {
  14. /**
  15. * Export user data
  16. *
  17. * @throws UserMigrationException
  18. * @since 24.0.0
  19. */
  20. public function export(
  21. IUser $user,
  22. IExportDestination $exportDestination,
  23. OutputInterface $output
  24. ): void;
  25. /**
  26. * Import user data
  27. *
  28. * @throws UserMigrationException
  29. * @since 24.0.0
  30. */
  31. public function import(
  32. IUser $user,
  33. IImportSource $importSource,
  34. OutputInterface $output
  35. ): void;
  36. /**
  37. * Returns the unique ID
  38. *
  39. * @since 24.0.0
  40. */
  41. public function getId(): string;
  42. /**
  43. * Returns the display name
  44. *
  45. * @since 24.0.0
  46. */
  47. public function getDisplayName(): string;
  48. /**
  49. * Returns the description
  50. *
  51. * @since 24.0.0
  52. */
  53. public function getDescription(): string;
  54. /**
  55. * Returns the version of the export format for this migrator
  56. *
  57. * @since 24.0.0
  58. */
  59. public function getVersion(): int;
  60. /**
  61. * Checks whether it is able to import a version of the export format for this migrator
  62. * Use $importSource->getMigratorVersion($this->getId()) to get the version from the archive
  63. *
  64. * @since 24.0.0
  65. */
  66. public function canImport(
  67. IImportSource $importSource
  68. ): bool;
  69. }