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:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-04-12 17:25:13 +0300
committerVincent Petry <vincent@nextcloud.com>2022-04-13 17:52:40 +0300
commit0fd72f4355c73a2f859e074754f0f255db16f536 (patch)
tree085a8c4438446f2f73b47f70f972c979b3ce0ef4 /apps/files_trashbin
parenta77ffe85936ab1ea9184935714b65320de95679a (diff)
Adapt existing migrators to new API
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r--apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php12
1 files changed, 5 insertions, 7 deletions
diff --git a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php
index 95ed25088b1..db5231ae019 100644
--- a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php
+++ b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php
@@ -74,18 +74,16 @@ class TrashbinMigrator implements IMigrator {
try {
$trashbinFolder = $this->root->get('/'.$uid.'/files_trashbin');
if (!$trashbinFolder instanceof Folder) {
- throw new UserMigrationException('Could not export trashbin, /'.$uid.'/files_trashbin is not a folder');
+ throw new UserMigrationException('/'.$uid.'/files_trashbin is not a folder');
}
$output->writeln("Exporting trashbin files…");
- if ($exportDestination->copyFolder($trashbinFolder, static::PATH_FILES_FOLDER) === false) {
- throw new UserMigrationException("Could not export trashbin.");
- }
+ $exportDestination->copyFolder($trashbinFolder, static::PATH_FILES_FOLDER);
$originalLocations = \OCA\Files_Trashbin\Trashbin::getLocations($uid);
- if ($exportDestination->addFileContents(static::PATH_LOCATIONS_FILE, json_encode($originalLocations)) === false) {
- throw new UserMigrationException("Could not export trashbin.");
- }
+ $exportDestination->addFileContents(static::PATH_LOCATIONS_FILE, json_encode($originalLocations);
} catch (NotFoundException $e) {
$output->writeln("No trashbin to export…");
+ } catch (UserMigrationException $e) {
+ throw new UserMigrationException("Could not export trashbin: ".$e->getMessage(), 0, $e);
}
}