From: Christopher Ng Date: Thu, 10 Mar 2022 05:49:33 +0000 (+0000) Subject: Use streams X-Git-Tag: v24.0.0beta1~24^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bf79b97718d42c932222738e83690ce2cea06890;p=nextcloud-server.git Use streams Signed-off-by: Christopher Ng --- diff --git a/apps/settings/lib/UserMigration/AccountMigrator.php b/apps/settings/lib/UserMigration/AccountMigrator.php index 58003244767..7129a8f8349 100644 --- a/apps/settings/lib/UserMigration/AccountMigrator.php +++ b/apps/settings/lib/UserMigration/AccountMigrator.php @@ -78,7 +78,7 @@ class AccountMigrator implements IMigrator { $exportFilename = AccountMigrator::EXPORT_AVATAR_BASENAME . '.' . $avatarFile->getExtension(); $output->writeln('Exporting avatar to ' . $exportFilename . '…'); - if ($exportDestination->addFileContents($exportFilename, $avatarFile->getContent()) === false) { + if ($exportDestination->addFileAsStream($exportFilename, $avatarFile->read()) === false) { throw new AccountMigratorException('Could not export avatar'); } } @@ -135,9 +135,9 @@ class AccountMigrator implements IMigrator { $importFilename = reset($avatarFiles); $output->writeln('Importing avatar from ' . $importFilename . '…'); - $data = $importSource->getFileContents($importFilename); + $stream = $importSource->getFileAsStream($importFilename); $image = new \OC_Image(); - $image->loadFromData($data); + $image->loadFromFileHandle($stream); try { $avatar = $this->avatarManager->getAvatar($user->getUID());