Skip to content

Commit cdee1e4

Browse files
committed
DD#0000: fix: Updated to use fetchCol and remove loop
1 parent 18a80e5 commit cdee1e4

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Console/Command/RemoveUnusedMediaCommand.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,11 @@ public function execute(InputInterface $input, OutputInterface $output) : void
7070
);
7171

7272
$directoryIterator = new \RecursiveDirectoryIterator($imageDir);
73-
74-
$imagesToKeepArray = $connection->fetchAll(
73+
74+
$imagesToKeep = $connection->fetchCol(
7575
'SELECT value FROM ' . $mediaGalleryTable
7676
);
7777

78-
$imagesToKeep = [];
79-
80-
foreach ($imagesToKeepArray as $image) {
81-
$imagesToKeep[] = $image['value'];
82-
}
83-
8478
foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) {
8579

8680
// Cached path guard

0 commit comments

Comments
 (0)