summaryrefslogtreecommitdiffstats
path: root/apps/settings/lib
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-04-12 16:25:13 +0200
committerVincent Petry <vincent@nextcloud.com>2022-04-13 16:52:40 +0200
commit0fd72f4355c73a2f859e074754f0f255db16f536 (patch)
tree085a8c4438446f2f73b47f70f972c979b3ce0ef4 /apps/settings/lib
parenta77ffe85936ab1ea9184935714b65320de95679a (diff)
downloadnextcloud-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/settings/lib')
-rw-r--r--apps/settings/lib/UserMigration/AccountMigrator.php22
1 files changed, 11 insertions, 11 deletions
diff --git a/apps/settings/lib/UserMigration/AccountMigrator.php b/apps/settings/lib/UserMigration/AccountMigrator.php
index e4218d72a76..32cf898f2bc 100644
--- a/apps/settings/lib/UserMigration/AccountMigrator.php
+++ b/apps/settings/lib/UserMigration/AccountMigrator.php
@@ -74,20 +74,20 @@ class AccountMigrator implements IMigrator {
public function export(IUser $user, IExportDestination $exportDestination, OutputInterface $output): void {
$output->writeln('Exporting account information in ' . AccountMigrator::PATH_ACCOUNT_FILE . '…');
- $account = $this->accountManager->getAccount($user);
- if ($exportDestination->addFileContents(AccountMigrator::PATH_ACCOUNT_FILE, json_encode($account)) === false) {
- throw new AccountMigratorException('Could not export account information');
- }
+ try {
+ $account = $this->accountManager->getAccount($user);
+ $exportDestination->addFileContents(AccountMigrator::PATH_ACCOUNT_FILE, json_encode($account));
- $avatar = $this->avatarManager->getAvatar($user->getUID());
- if ($avatar->isCustomAvatar()) {
- $avatarFile = $avatar->getFile(-1);
- $exportPath = AccountMigrator::PATH_ROOT . AccountMigrator::AVATAR_BASENAME . '.' . $avatarFile->getExtension();
+ $avatar = $this->avatarManager->getAvatar($user->getUID());
+ if ($avatar->isCustomAvatar()) {
+ $avatarFile = $avatar->getFile(-1);
+ $exportPath = AccountMigrator::PATH_ROOT . AccountMigrator::AVATAR_BASENAME . '.' . $avatarFile->getExtension();
- $output->writeln('Exporting avatar to ' . $exportPath . '…');
- if ($exportDestination->addFileAsStream($exportPath, $avatarFile->read()) === false) {
- throw new AccountMigratorException('Could not export avatar');
+ $output->writeln('Exporting avatar to ' . $exportPath . '…');
+ $exportDestination->addFileAsStream($exportPath, $avatarFile->read());
}
+ } catch (Throwable $e) {
+ throw new AccountMigratorException('Could not export account information', 0, $e);
}
}