Refactors php_tar.

This commit is contained in:
Lars Jung 2013-07-20 14:51:12 +02:00
parent 8d06364046
commit 28d7b128e9

View file

@ -79,10 +79,11 @@ class Archive {
} }
foreach ($files as $real_file => $archived_file) { foreach ($files as $real_file => $archived_file) {
echo $this->php_tar_fileheader($real_file, $archived_file); $size = $filesizes[$real_file];
echo $this->php_tar_fileheader($real_file, $archived_file, $size);
$this->print_file($real_file); $this->print_file($real_file);
$size = $filesizes[$real_file];
if ($size % 512 != 0) { if ($size % 512 != 0) {
echo str_repeat("\0", 512 - ($size % 512)); echo str_repeat("\0", 512 - ($size % 512));
} }
@ -98,9 +99,9 @@ class Archive {
} }
private function php_tar_fileheader($real_file, $archived_file) { private function php_tar_fileheader($real_file, $archived_file, $size) {
return $this->php_tar_header($archived_file, @filesize($real_file), @filemtime($real_file), 0); return $this->php_tar_header($archived_file, $size, @filemtime($real_file), 0);
} }