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
diff options
context:
space:
mode:
authorPytal <24800714+Pytal@users.noreply.github.com>2022-03-15 05:17:47 +0300
committerGitHub <noreply@github.com>2022-03-15 05:17:47 +0300
commite9999ec90c794a4d5c0d56de8a643d1c51889658 (patch)
tree7be0b27a36da4840d05543ac757e192c7eb5464c
parenta5e1e31350a344359302c855958a3c7d922331f9 (diff)
parent8f97f722ecb98dff6226d2b2572bfe1ae49869a6 (diff)
Merge pull request #31516 from nextcloud/enh/improve-user_migration-api
-rw-r--r--apps/dav/lib/UserMigration/CalendarMigratorException.php4
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
-rw-r--r--lib/public/UserMigration/IImportSource.php15
-rw-r--r--lib/public/UserMigration/IMigrator.php2
-rw-r--r--lib/public/UserMigration/TMigratorBasicVersionHandling.php1
-rw-r--r--lib/public/UserMigration/UserMigrationException.php33
7 files changed, 55 insertions, 2 deletions
diff --git a/apps/dav/lib/UserMigration/CalendarMigratorException.php b/apps/dav/lib/UserMigration/CalendarMigratorException.php
index 91bac58ffac..3b4f8f89232 100644
--- a/apps/dav/lib/UserMigration/CalendarMigratorException.php
+++ b/apps/dav/lib/UserMigration/CalendarMigratorException.php
@@ -26,7 +26,7 @@ declare(strict_types=1);
namespace OCA\DAV\UserMigration;
-use Exception;
+use OCP\UserMigration\UserMigrationException;
-class CalendarMigratorException extends Exception {
+class CalendarMigratorException extends UserMigrationException {
}
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 86efab3ad52..7ba3c7c0840 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -549,6 +549,7 @@ return array(
'OCP\\UserMigration\\IImportSource' => $baseDir . '/lib/public/UserMigration/IImportSource.php',
'OCP\\UserMigration\\IMigrator' => $baseDir . '/lib/public/UserMigration/IMigrator.php',
'OCP\\UserMigration\\TMigratorBasicVersionHandling' => $baseDir . '/lib/public/UserMigration/TMigratorBasicVersionHandling.php',
+ 'OCP\\UserMigration\\UserMigrationException' => $baseDir . '/lib/public/UserMigration/UserMigrationException.php',
'OCP\\UserStatus\\IManager' => $baseDir . '/lib/public/UserStatus/IManager.php',
'OCP\\UserStatus\\IProvider' => $baseDir . '/lib/public/UserStatus/IProvider.php',
'OCP\\UserStatus\\IUserStatus' => $baseDir . '/lib/public/UserStatus/IUserStatus.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index ea37771d63c..69ad8764822 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -578,6 +578,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\UserMigration\\IImportSource' => __DIR__ . '/../../..' . '/lib/public/UserMigration/IImportSource.php',
'OCP\\UserMigration\\IMigrator' => __DIR__ . '/../../..' . '/lib/public/UserMigration/IMigrator.php',
'OCP\\UserMigration\\TMigratorBasicVersionHandling' => __DIR__ . '/../../..' . '/lib/public/UserMigration/TMigratorBasicVersionHandling.php',
+ 'OCP\\UserMigration\\UserMigrationException' => __DIR__ . '/../../..' . '/lib/public/UserMigration/UserMigrationException.php',
'OCP\\UserStatus\\IManager' => __DIR__ . '/../../..' . '/lib/public/UserStatus/IManager.php',
'OCP\\UserStatus\\IProvider' => __DIR__ . '/../../..' . '/lib/public/UserStatus/IProvider.php',
'OCP\\UserStatus\\IUserStatus' => __DIR__ . '/../../..' . '/lib/public/UserStatus/IUserStatus.php',
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 {
+}