Closed vctsvz closed 4 years ago
Counting the file size $size += $file->getSize(); occurs after the file is deleted $this->driverFile->deleteFile($file);, which leads to an error: SplFileInfo::getSize(): stat failed for /some/path/some_image.jpg
$size += $file->getSize();
$this->driverFile->deleteFile($file);
vendor/cap/cleanmedia/Console/Command/CleanMedia.php:118-137
/** @var SplFileInfo $file */ foreach ($iterator as $file) { if ($isNoCache) { if (strpos($file, "/cache") !== false) { continue; } } $filename = $file->getFilename(); if (!in_array($filename, $inDb)) { $fileRelativePath = str_replace($mediaPath, '', $file->getPathname()); if (!$isDryRun) { $output->writeln('<comment>REMOVING: </comment>' . $fileRelativePath); $this->driverFile->deleteFile($file); } else { $output->writeln('<comment>DRY-RUN: </comment>' . $fileRelativePath); } $count++; $size += $file->getSize(); } }
Counting the file size
$size += $file->getSize();
occurs after the file is deleted$this->driverFile->deleteFile($file);
, which leads to an error: SplFileInfo::getSize(): stat failed for /some/path/some_image.jpgvendor/cap/cleanmedia/Console/Command/CleanMedia.php:118-137