2022-02-04 15:49:11 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2022-02-04 15:49:11 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace OCP\UserMigration;
|
|
|
|
|
|
|
|
|
|
use OCP\IUser;
|
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 24.0.0
|
|
|
|
|
*/
|
|
|
|
|
interface IMigrator {
|
|
|
|
|
/**
|
|
|
|
|
* Export user data
|
|
|
|
|
*
|
2022-03-10 05:35:07 -05:00
|
|
|
* @throws UserMigrationException
|
2022-02-04 15:49:11 -05:00
|
|
|
* @since 24.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function export(
|
|
|
|
|
IUser $user,
|
|
|
|
|
IExportDestination $exportDestination,
|
|
|
|
|
OutputInterface $output,
|
|
|
|
|
): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Import user data
|
|
|
|
|
*
|
2022-03-10 05:35:07 -05:00
|
|
|
* @throws UserMigrationException
|
2022-02-04 15:49:11 -05:00
|
|
|
* @since 24.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function import(
|
|
|
|
|
IUser $user,
|
|
|
|
|
IImportSource $importSource,
|
2022-02-17 12:09:14 -05:00
|
|
|
OutputInterface $output,
|
2022-02-04 15:49:11 -05:00
|
|
|
): void;
|
2022-02-14 10:48:08 -05:00
|
|
|
|
2022-04-08 14:33:42 -04:00
|
|
|
/**
|
|
|
|
|
* Returns the unique ID
|
|
|
|
|
*
|
|
|
|
|
* @since 24.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getId(): string;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the display name
|
|
|
|
|
*
|
|
|
|
|
* @since 24.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getDisplayName(): string;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the description
|
|
|
|
|
*
|
|
|
|
|
* @since 24.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getDescription(): string;
|
|
|
|
|
|
2022-02-14 10:48:08 -05:00
|
|
|
/**
|
|
|
|
|
* Returns the version of the export format for this migrator
|
|
|
|
|
*
|
|
|
|
|
* @since 24.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getVersion(): int;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks whether it is able to import a version of the export format for this migrator
|
2022-04-11 04:53:51 -04:00
|
|
|
* Use $importSource->getMigratorVersion($this->getId()) to get the version from the archive
|
2022-02-15 03:56:45 -05:00
|
|
|
*
|
2022-02-14 10:48:08 -05:00
|
|
|
* @since 24.0.0
|
|
|
|
|
*/
|
2022-02-15 03:56:45 -05:00
|
|
|
public function canImport(
|
2022-02-17 12:09:14 -05:00
|
|
|
IImportSource $importSource,
|
2022-02-15 03:56:45 -05:00
|
|
|
): bool;
|
2022-02-04 15:49:11 -05:00
|
|
|
}
|