service/models/StoredContent.php
/**
     * Compacts chunks.
     *
     * Removes chunks which have 0 length.
     * Removes chunks which are part of other chunks.
     *
     * @return void
     */
Compacts chunks.
Removes chunks which have 0 length.
Removes chunks which are part of other chunks.

@return void
Compacts chunks . Removes chunks which have 0 length . Removes chunks which are part of other chunks . @return void
public function compactChunks()
    {
        $redurant = [];
        foreach ($this->getChunks()->where(['locked' => 0])->each() as $chunk) {
            if ($chunk->length == 0 || $chunk->end >= $this->size) {
                $redurant[] = $chunk->id;
            }
            foreach ($this->chunks as $_chunk) {
                if ($chunk->id != $_chunk->id && $chunk->start >= $_chunk->start && $chunk->end <= $_chunk->end) {
                    $redurant[] = $chunk->id;
                }
            }
        }
        $this->deleteChunks(['id' => $redurant]);
    }
public function compactChunks ( ) { $ redurant = [ ] ; foreach ( $ this -> getChunks ( ) -> where ( [ 'locked' => 0 ] ) -> each ( ) as $ chunk ) { if ( $ chunk -> length == 0 || $ chunk -> end >= $ this -> size ) { $ redurant [ ] = $ chunk -> id ; } foreach ( $ this -> chunks as $ _chunk ) { if ( $ chunk -> id != $ _chunk -> id && $ chunk -> start >= $ _chunk -> start && $ chunk -> end <= $ _chunk -> end ) { $ redurant [ ] = $ chunk -> id ; } } } $ this -> deleteChunks ( [ 'id' => $ redurant ] ) ; }
Compacts chunks.
Compacts chunks .
//Remove chunks with zero length and invalid chunks //Remove redurant chunks