Exemple #1
0
 /**
  * @param string $target_file
  * @param array $file_list
  * @param bool $gzip
  * @return bool
  */
 public static function pack($target_file, $file_list, $gzip = false)
 {
     $t = new Tar();
     foreach ($file_list as $item) {
         $t->addFile(self::normalizePath($item));
     }
     $response = $t->toTar(self::normalizePath($target_file), $gzip);
     return $response;
 }
Exemple #2
0
 /**
  * A file of exactly one block should be just a header block + data block + the footer
  */
 public function test_blockfile()
 {
     $dir = dirname(__FILE__) . '/tar';
     $tar = new Tar();
     $tar->create();
     $tar->addFile("{$dir}/block.txt", 'block.txt');
     $file = $tar->getArchive(Tar::COMPRESS_NONE);
     $this->assertEquals(512 * 4, strlen($file));
     // 1 header block + data block + 2 footer blocks
 }