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:
authorVincent Petry <vincent@nextcloud.com>2022-04-13 10:56:07 +0300
committerVincent Petry <vincent@nextcloud.com>2022-04-13 17:52:40 +0300
commit78c8e578966e3867f583ca3a2aacda583c5ecfbd (patch)
tree765ea9fa2d07f0c581a014fce5f5a658dd5ef94f /apps/files_trashbin
parent0fd72f4355c73a2f859e074754f0f255db16f536 (diff)
Fix migrators according to exceptions
Fixed syntax errors. Removed if condition for copyToFolder since it's void now. Change signature of setMigratorVersions to also be void. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r--apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php
index db5231ae019..dbc6267eb3a 100644
--- a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php
+++ b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php
@@ -79,10 +79,10 @@ class TrashbinMigrator implements IMigrator {
$output->writeln("Exporting trashbin files…");
$exportDestination->copyFolder($trashbinFolder, static::PATH_FILES_FOLDER);
$originalLocations = \OCA\Files_Trashbin\Trashbin::getLocations($uid);
- $exportDestination->addFileContents(static::PATH_LOCATIONS_FILE, json_encode($originalLocations);
+ $exportDestination->addFileContents(static::PATH_LOCATIONS_FILE, json_encode($originalLocations));
} catch (NotFoundException $e) {
$output->writeln("No trashbin to export…");
- } catch (UserMigrationException $e) {
+ } catch (\Throwable $e) {
throw new UserMigrationException("Could not export trashbin: ".$e->getMessage(), 0, $e);
}
}
@@ -110,8 +110,10 @@ class TrashbinMigrator implements IMigrator {
$trashbinFolder = $this->root->newFolder('/'.$uid.'/files_trashbin');
}
$output->writeln("Importing trashbin files…");
- if ($importSource->copyToFolder($trashbinFolder, static::PATH_FILES_FOLDER) === false) {
- throw new UserMigrationException("Could not import trashbin.");
+ try {
+ $importSource->copyToFolder($trashbinFolder, static::PATH_FILES_FOLDER);
+ } catch (\Throwable $e) {
+ throw new UserMigrationException("Could not import trashbin.", 0, $e);
}
$locations = json_decode($importSource->getFileContents(static::PATH_LOCATIONS_FILE), true, 512, JSON_THROW_ON_ERROR);
$qb = $this->dbc->getQueryBuilder();