Skip to content

Commit

Permalink
make copyToMediaLibraryFromRemote more extensible (#3361)
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmastech authored Sep 4, 2023
1 parent ca20c58 commit ef5e385
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/MediaCollections/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public function addRemote(RemoteFile $file, Media $media, ?string $targetFileNam
return true;
}

public function prepareCopyFileOnDisk(RemoteFile $file, Media $media, string $destination): void
{
$this->copyFileOnDisk($file->getKey(), $destination, $media->disk);
}

public function copyToMediaLibraryFromRemote(RemoteFile $file, Media $media, ?string $type = null, ?string $targetFileName = null): void
{
$destinationFileName = $targetFileName ?: $file->getFilename();
Expand All @@ -65,7 +70,7 @@ public function copyToMediaLibraryFromRemote(RemoteFile $file, Media $media, ?st
: $media->getDiskDriverName();

if ($this->shouldCopyFileOnDisk($file, $media, $diskDriverName)) {
$this->copyFileOnDisk($file->getKey(), $destination, $media->disk);
$this->prepareCopyFileOnDisk($file, $media, $destination);

return;
}
Expand Down

0 comments on commit ef5e385

Please sign in to comment.