mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #31516 from nextcloud/enh/improve-user_migration-api
This commit is contained in:
commit
e9999ec90c
7 changed files with 55 additions and 2 deletions
|
|
@ -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 {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -63,6 +64,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
|
||||
*
|
||||
|
|
@ -89,6 +97,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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
33
lib/public/UserMigration/UserMigrationException.php
Normal file
33
lib/public/UserMigration/UserMigrationException.php
Normal file
|
|
@ -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 {
|
||||
}
|
||||
Loading…
Reference in a new issue