public function testGzipWithFile() { if (function_exists('gzcompress')) { $compressed = Gzip::compress(__DIR__ . '/../tmp/access.txt'); $this->fileExists(__DIR__ . '/../tmp/access.txt.gz'); $decompressed = Gzip::decompress($compressed); $this->fileExists(__DIR__ . '/../tmp/access.txt'); if (file_exists(__DIR__ . '/../tmp/access.txt.gz')) { unlink(__DIR__ . '/../tmp/access.txt.gz'); } } }
/** * Method to extract an archived and/or compressed file * * @param string $to * @return void */ public function extract($to = null) { if ($this->compression == 'bz') { $this->path = Compress\Bzip2::decompress($this->path); $this->archive = new \Archive_Tar($this->path); } else { if ($this->compression == 'gz') { $this->path = Compress\Gzip::decompress($this->path); $this->archive = new \Archive_Tar($this->path); } } $this->archive->extract(null !== $to ? $to : './'); }