Skip to content

Commit e994e70

Browse files
committed
CLI Command to sync media gallery failure when S3 is enabled is fixed
1 parent 9d69186 commit e994e70

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

app/code/Magento/MediaGallerySynchronization/Model/FetchMediaStorageFileBatches.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,14 @@ public function execute(): \Traversable
8787
$batch = [];
8888
$mediaDirectory = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA);
8989

90-
/** @var \SplFileInfo $file */
91-
foreach ($this->getAssetsIterator->execute($mediaDirectory->getAbsolutePath()) as $file) {
92-
$relativePath = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA)
93-
->getRelativePath($file->getPathName());
94-
if (!$this->isApplicable($relativePath)) {
90+
foreach ($mediaDirectory->readRecursively($mediaDirectory->getAbsolutePath()) as $file) {
91+
92+
if (!$this->isApplicable($file)) {
9593
continue;
9694
}
9795

98-
$batch[] = $relativePath;
96+
$batch[] = $file;
97+
9998
if (++$i == $this->batchSize) {
10099
yield $batch;
101100
$i = 0;

0 commit comments

Comments
 (0)