Skip to content

Commit

Permalink
chore: update for gdpr beta 18 (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland authored Oct 30, 2023
1 parent 09d7c18 commit 2f7c06d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Data/Uploads.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Blomstra\Gdpr\Data\Type;
use FoF\Upload\Downloader\DefaultDownloader;
use FoF\Upload\File;
use PhpZip\ZipFile;

class Uploads extends Type
{
Expand All @@ -24,21 +23,22 @@ public static function exportDescription(): string
return 'All files uploaded by the user.';
}

public function export(ZipFile $zip): void
public function export(): ?array
{
/** @var DefaultDownloader $downloader */
$downloader = resolve(DefaultDownloader::class);

$dataExport = [];

File::query()
->where('actor_id', $this->user->id)
->orderBy('id', 'asc')
->each(function (File $file) use ($zip, $downloader) {
->each(function (File $file) use ($downloader, &$dataExport) {
$fileContent = $downloader->download($file)->getBody()->getContents();
$zip->addFromString(
"uploads/{$file->path}",
$fileContent
);
$dataExport[] = ["uploads/{$file->path}" => $fileContent];
});

return $dataExport;
}

public static function anonymizeDescription(): string
Expand Down

0 comments on commit 2f7c06d

Please sign in to comment.