public function handle(ChunkStorage $storage)
    {
        $verbouse = OutputInterface::VERBOSITY_VERBOSE;

        // try to get the old chunk files
        $oldFiles = $storage->oldChunkFiles();

        if ($oldFiles->isEmpty()) {
            $this->warn('Chunks: no old files');

            return;
        }

        $this->info(sprintf('Found %d chunk files', $oldFiles->count()), $verbouse);
        $deleted = 0;

        /** @var ChunkFile $file */
        foreach ($oldFiles as $file) {
            // debug the file info
            $this->comment('> '.$file, $verbouse);

            // delete the file
            if ($file->delete()) {
                ++$deleted;
            } else {
                $this->error('> chunk not deleted: '.$file);
            }
        }

        $this->info('Chunks: cleared '.$deleted.' '.Str::plural('file', $deleted));
    }
public function handle(ChunkStorage $storage)
    {
        $verbouse = OutputInterface::VERBOSITY_VERBOSE;

        // try to get the old chunk files
        $oldFiles = $storage->oldChunkFiles();

        if ($oldFiles->isEmpty()) {
            $this->warn('Chunks: no old files');

            return;
        }

        $this->info(sprintf('Found %d chunk files', $oldFiles->count()), $verbouse);
        $deleted = 0;

        /** @var ChunkFile $file */
        foreach ($oldFiles as $file) {
            // debug the file info
            $this->comment('> '.$file, $verbouse);

            // delete the file
            if ($file->delete()) {
                ++$deleted;
            } else {
                $this->error('> chunk not deleted: '.$file);
            }
        }

        $this->info('Chunks: cleared '.$deleted.' '.Str::plural('file', $deleted));
    }
public function handle ( ChunkStorage $ storage ) { $ verbouse = OutputInterface :: VERBOSITY_VERBOSE ; // try to get the old chunk files $ oldFiles = $ storage -> oldChunkFiles ( ) ; if ( $ oldFiles -> isEmpty ( ) ) { $ this -> warn ( 'Chunks: no old files' ) ; return ; } $ this -> info ( sprintf ( 'Found %d chunk files' , $ oldFiles -> count ( ) ) , $ verbouse ) ; $ deleted = 0 ; /** @var ChunkFile $file */ foreach ( $ oldFiles as $ file ) { // debug the file info $ this -> comment ( '> ' . $ file , $ verbouse ) ; // delete the file if ( $ file -> delete ( ) ) { ++ $ deleted ; } else { $ this -> error ( '> chunk not deleted: ' . $ file ) ; } } $ this -> info ( 'Chunks: cleared ' . $ deleted . ' ' . Str :: plural ( 'file' , $ deleted ) ) ; }
Clears the chunks upload directory.

@param ChunkStorage $storage injected chunk storage
Clears the chunks upload directory .