Spatie\MediaLibrary\Commands\CleanCommand::deleteFilesGeneratedForDeprecatedConversions PHP Метод

deleteFilesGeneratedForDeprecatedConversions() защищенный Метод

    protected function deleteFilesGeneratedForDeprecatedConversions()
    {
        $this->getMediaItems()->each(function (Media $media) {
            $conversionFilePaths = ConversionCollection::createForMedia($media)->getConversionsFiles($media->collection_name);
            $path = $this->basePathGenerator->getPathForConversions($media);
            $currentFilePaths = $this->fileSystem->disk($media->disk)->files($path);
            collect($currentFilePaths)->filter(function (string $currentFilePath) use($conversionFilePaths) {
                return !$conversionFilePaths->contains(basename($currentFilePath));
            })->each(function (string $currentFilePath) use($media) {
                if (!$this->isDryRun) {
                    $this->fileSystem->disk($media->disk)->delete($currentFilePath);
                }
                $this->info("Deprecated conversion file `{$currentFilePath}` " . ($this->isDryRun ? 'found' : 'has been removed'));
            });
        });
    }