IMigrator.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2022 Christopher Ng <chrng8@gmail.com>
  5. *
  6. * @author Christopher Ng <chrng8@gmail.com>
  7. * @author Côme Chilliet <come.chilliet@nextcloud.com>
  8. *
  9. * @license GNU AGPL version 3 or any later version
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License as
  13. * published by the Free Software Foundation, either version 3 of the
  14. * License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. */
  25. namespace OCP\UserMigration;
  26. use OCP\IUser;
  27. use Symfony\Component\Console\Output\OutputInterface;
  28. /**
  29. * @since 24.0.0
  30. */
  31. interface IMigrator {
  32. /**
  33. * Export user data
  34. *
  35. * @throws UserMigrationException
  36. * @since 24.0.0
  37. */
  38. public function export(
  39. IUser $user,
  40. IExportDestination $exportDestination,
  41. OutputInterface $output
  42. ): void;
  43. /**
  44. * Import user data
  45. *
  46. * @throws UserMigrationException
  47. * @since 24.0.0
  48. */
  49. public function import(
  50. IUser $user,
  51. IImportSource $importSource,
  52. OutputInterface $output
  53. ): void;
  54. /**
  55. * Returns the unique ID
  56. *
  57. * @since 24.0.0
  58. */
  59. public function getId(): string;
  60. /**
  61. * Returns the display name
  62. *
  63. * @since 24.0.0
  64. */
  65. public function getDisplayName(): string;
  66. /**
  67. * Returns the description
  68. *
  69. * @since 24.0.0
  70. */
  71. public function getDescription(): string;
  72. /**
  73. * Returns the version of the export format for this migrator
  74. *
  75. * @since 24.0.0
  76. */
  77. public function getVersion(): int;
  78. /**
  79. * Checks whether it is able to import a version of the export format for this migrator
  80. * Use $importSource->getMigratorVersion($this->getId()) to get the version from the archive
  81. *
  82. * @since 24.0.0
  83. */
  84. public function canImport(
  85. IImportSource $importSource
  86. ): bool;
  87. }