summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-04-13 18:55:37 +0200
committerGitHub <noreply@github.com>2022-04-13 18:55:37 +0200
commit58f5de08dfe7796e61754adf7f618ea6d48ef343 (patch)
tree94fc88ca0c852a6d08ffbdbf98be2fa9e08108ae /lib
parent964bc57eed6cb943aa19468ec679549496453ec9 (diff)
parent78c8e578966e3867f583ca3a2aacda583c5ecfbd (diff)
downloadnextcloud-server-58f5de08dfe7796e61754adf7f618ea6d48ef343.tar.gz
nextcloud-server-58f5de08dfe7796e61754adf7f618ea6d48ef343.zip
Merge pull request #31945 from nextcloud/fix/user_migration-use-exceptions
Adapt user_migration APIs to have information about failures
Diffstat (limited to 'lib')
-rw-r--r--lib/public/UserMigration/IExportDestination.php17
-rw-r--r--lib/public/UserMigration/IImportSource.php16
2 files changed, 24 insertions, 9 deletions
diff --git a/lib/public/UserMigration/IExportDestination.php b/lib/public/UserMigration/IExportDestination.php
index a721efcdf93..65d228faeb9 100644
--- a/lib/public/UserMigration/IExportDestination.php
+++ b/lib/public/UserMigration/IExportDestination.php
@@ -38,44 +38,47 @@ interface IExportDestination {
*
* @param string $path Full path to the file in the export archive. Parent directories will be created if needed.
* @param string $content The full content of the file.
- * @return bool whether the file contents were successfully added.
+ * @throws UserMigrationException
*
* @since 24.0.0
*/
- public function addFileContents(string $path, string $content): bool;
+ public function addFileContents(string $path, string $content): void;
/**
* Adds a file to the export as a stream
*
* @param string $path Full path to the file in the export archive. Parent directories will be created if needed.
* @param resource $stream A stream resource to read from to get the file content.
- * @return bool whether the file stream was successfully added.
+ * @throws UserMigrationException
*
* @since 24.0.0
*/
- public function addFileAsStream(string $path, $stream): bool;
+ public function addFileAsStream(string $path, $stream): void;
/**
* Copy a folder to the export
*
* @param Folder $folder folder to copy to the export archive.
* @param string $destinationPath Full path to the folder in the export archive. Parent directories will be created if needed.
- * @return bool whether the folder was successfully added.
+ * @throws UserMigrationException
*
* @since 24.0.0
*/
- public function copyFolder(Folder $folder, string $destinationPath): bool;
+ public function copyFolder(Folder $folder, string $destinationPath): void;
/**
* @param array<string,int> $versions Migrators and their versions.
+ * @throws UserMigrationException
*
* @since 24.0.0
*/
- public function setMigratorVersions(array $versions): bool;
+ public function setMigratorVersions(array $versions): void;
/**
* Called after export is complete
*
+ * @throws UserMigrationException
+ *
* @since 24.0.0
*/
public function close(): void;
diff --git a/lib/public/UserMigration/IImportSource.php b/lib/public/UserMigration/IImportSource.php
index 3816afdd033..da2c87ba241 100644
--- a/lib/public/UserMigration/IImportSource.php
+++ b/lib/public/UserMigration/IImportSource.php
@@ -39,6 +39,7 @@ interface IImportSource {
*
* @param string $path Full path to the file in the export archive.
* @return string The full content of the file.
+ * @throws UserMigrationException
*
* @since 24.0.0
*/
@@ -49,6 +50,7 @@ interface IImportSource {
*
* @param string $path Full path to the file in the export archive.
* @return resource A stream resource to read from to get the file content.
+ * @throws UserMigrationException
*
* @since 24.0.0
*/
@@ -59,6 +61,7 @@ interface IImportSource {
*
* @param string $path Full path to the folder in the export archive.
* @return array The list of files.
+ * @throws UserMigrationException
*
* @since 24.0.0
*/
@@ -67,6 +70,8 @@ interface IImportSource {
/**
* Test if a path exists, which may be a file or a folder
*
+ * @throws UserMigrationException
+ *
* @since 24.0.0
*/
public function pathExists(string $path): bool;
@@ -77,12 +82,15 @@ interface IImportSource {
* Folder $destination folder to copy into
* string $sourcePath path in the export archive
*
+ * @throws UserMigrationException
+ *
* @since 24.0.0
*/
- public function copyToFolder(Folder $destination, string $sourcePath): bool;
+ public function copyToFolder(Folder $destination, string $sourcePath): void;
/**
* @return array<string,int> Migrators and their versions from the export archive.
+ * @throws UserMigrationException
*
* @since 24.0.0
*/
@@ -90,7 +98,7 @@ interface IImportSource {
/**
* @return ?int Version for this migrator from the export archive. Null means migrator missing.
- *
+ * @throws UserMigrationException
* @param string $migrator Migrator id (as returned by IMigrator::getId)
*
* @since 24.0.0
@@ -100,6 +108,8 @@ interface IImportSource {
/**
* Get original uid of the imported account
*
+ * @throws UserMigrationException
+ *
* @since 24.0.0
*/
public function getOriginalUid(): string;
@@ -107,6 +117,8 @@ interface IImportSource {
/**
* Called after import is complete
*
+ * @throws UserMigrationException
+ *
* @since 24.0.0
*/
public function close(): void;