diff options
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/UserMigration/IImportSource.php | 15 | ||||
-rw-r--r-- | lib/public/UserMigration/IMigrator.php | 2 | ||||
-rw-r--r-- | lib/public/UserMigration/TMigratorBasicVersionHandling.php | 1 | ||||
-rw-r--r-- | lib/public/UserMigration/UserMigrationException.php | 33 |
4 files changed, 51 insertions, 0 deletions
diff --git a/lib/public/UserMigration/IImportSource.php b/lib/public/UserMigration/IImportSource.php index df91c0e71ab..d34f2752549 100644 --- a/lib/public/UserMigration/IImportSource.php +++ b/lib/public/UserMigration/IImportSource.php @@ -32,6 +32,7 @@ use OCP\Files\Folder; * @since 24.0.0 */ interface IImportSource { + public const PATH_USER = 'user.json'; /** * Reads a file from the export @@ -64,6 +65,13 @@ interface IImportSource { public function getFolderListing(string $path): array; /** + * Test if a path exists, which may be a file or a folder + * + * @since 24.0.0 + */ + public function pathExists(string $path): bool; + + /** * Copy files from the export to a Folder * * Folder $destination folder to copy into @@ -90,6 +98,13 @@ interface IImportSource { public function getMigratorVersion(string $migrator): ?int; /** + * Get original uid of the imported account + * + * @since 24.0.0 + */ + public function getOriginalUid(): string; + + /** * Called after import is complete * * @since 24.0.0 diff --git a/lib/public/UserMigration/IMigrator.php b/lib/public/UserMigration/IMigrator.php index 4ff09167f5e..c97fb3c0bca 100644 --- a/lib/public/UserMigration/IMigrator.php +++ b/lib/public/UserMigration/IMigrator.php @@ -38,6 +38,7 @@ interface IMigrator { /** * Export user data * + * @throws UserMigrationException * @since 24.0.0 */ public function export( @@ -49,6 +50,7 @@ interface IMigrator { /** * Import user data * + * @throws UserMigrationException * @since 24.0.0 */ public function import( diff --git a/lib/public/UserMigration/TMigratorBasicVersionHandling.php b/lib/public/UserMigration/TMigratorBasicVersionHandling.php index 5554bb90a91..20a30a24307 100644 --- a/lib/public/UserMigration/TMigratorBasicVersionHandling.php +++ b/lib/public/UserMigration/TMigratorBasicVersionHandling.php @@ -28,6 +28,7 @@ namespace OCP\UserMigration; /** * Basic version handling: we can import older versions but not newer ones + * @since 24.0.0 */ trait TMigratorBasicVersionHandling { protected int $version = 1; diff --git a/lib/public/UserMigration/UserMigrationException.php b/lib/public/UserMigration/UserMigrationException.php new file mode 100644 index 00000000000..ed8c28a6208 --- /dev/null +++ b/lib/public/UserMigration/UserMigrationException.php @@ -0,0 +1,33 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2022 Côme Chilliet <come.chilliet@nextcloud.com> + * + * @author Côme Chilliet <come.chilliet@nextcloud.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\UserMigration; + +/** + * @since 24.0.0 + */ +class UserMigrationException extends \Exception { +} |