diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-04-12 16:25:13 +0200 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2022-04-13 16:52:40 +0200 |
commit | 0fd72f4355c73a2f859e074754f0f255db16f536 (patch) | |
tree | 085a8c4438446f2f73b47f70f972c979b3ce0ef4 /apps/files_trashbin/lib | |
parent | a77ffe85936ab1ea9184935714b65320de95679a (diff) | |
download | nextcloud-server-0fd72f4355c73a2f859e074754f0f255db16f536.tar.gz nextcloud-server-0fd72f4355c73a2f859e074754f0f255db16f536.zip |
Adapt existing migrators to new API
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/files_trashbin/lib')
-rw-r--r-- | apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php | 12 |
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); } } |