/home/techb158/immovalet.com/platform/core/media/src/Commands
Edit: /home/techb158/immovalet.com/platform/core/media/src/Commands/ClearChunksCommand.php (1785B)
storage = $storage;
}
/**
* Clears the chunks upload directory.
*/
public function handle()
{
$verbose = OutputInterface::VERBOSITY_VERBOSE;
// Try to get the old chunk files
$oldFiles = $this->storage->oldChunkFiles();
if ($oldFiles->isEmpty()) {
$this->warn('Chunks: no old files');
return;
}
$this->info(sprintf('Found %d chunk files', $oldFiles->count()), $verbose);
$deleted = 0;
/**
* @var ChunkFile $file
*/
foreach ($oldFiles as $file) {
$this->comment('> ' . $file, $verbose);
if ($file->delete()) {
++$deleted;
} else {
$this->error('> chunk not deleted: ' . $file);
}
}
$this->info('Chunks: cleared ' . $deleted . ' ' . Str::plural('file', $deleted));
}
}