public function test_blockdata() { $tar = new Tar(); $tar->setCompression(0); $tar->create(); $tar->addData('block.txt', str_pad('', 512, 'x')); $file = $tar->getArchive(); $this->assertEquals(512 * 4, strlen($file)); // 1 header block + data block + 2 footer blocks }
public function get_hashes() { $this->job->log(__('Getting checksum file from archive...', 'my-wp-backup'), 'debug'); if ('zip' === $this->format) { $archive = new Zip(); } else { $archive = new Tar(); if ($this->is_compressed()) { $archive->setCompression(9, $this->compression); } } $archive->open($this->archives[0]); $archive->extract(sys_get_temp_dir(), '', '', '#\\.my-wp-backup$#'); $this->job->move_hashfile(sys_get_temp_dir() . '/.my-wp-backup'); $this->job->log(__('Ok.', 'my-wp-backup'), 'debug'); return $this->backup->get_files(); }