]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use streams
authorChristopher Ng <chrng8@gmail.com>
Thu, 10 Mar 2022 05:49:33 +0000 (05:49 +0000)
committerChristopher Ng <chrng8@gmail.com>
Fri, 18 Mar 2022 04:51:26 +0000 (04:51 +0000)
Signed-off-by: Christopher Ng <chrng8@gmail.com>
apps/settings/lib/UserMigration/AccountMigrator.php

index 5800324476753cb4207da1e58e44060c0db06d90..7129a8f8349b8344dba5c5cfe517624301c8baf5 100644 (file)
@@ -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());