/** * Creates and initializes a new header. * * If the ezcArchiveBlockFile $file is null then the header will be empty. * When an ezcArchiveBlockFile is given, the block position should point to the header block. * This header block will be read from the file and initialized in this class. * * @param ezcArchiveBlockFile $file */ public function __construct(ezcArchiveBlockFile $file = null) { if (!is_null($file)) { // FIXME Assumed a while.. check the gnu tar source file. // FIXME Check long links, really large files, etc. $extensions = array(); do { parent::__construct($file); switch ($this->type) { case "L": $extensions["fileName"] = $this->readExtension($file); break; case "K": $extensions["linkName"] = $this->readExtension($file); break; } } while ($this->type < 0 || $this->type > 9); parent::__construct($file); foreach ($extensions as $key => $value) { switch ($key) { case "fileName": $this->fileName = $extensions["fileName"]; $this->filePrefix = ""; break; case "linkName": $this->linkName = $extensions["linkName"]; break; } } } }
/** * Creates and initializes a new header. * * If the ezcArchiveBlockFile $file is null then the header will be empty. * When an ezcArchiveBlockFile is given, the block position should point to the header block. * This header block will be read from the file and initialized in this class. * * @param ezcArchiveBlockFile $file */ public function __construct(ezcArchiveBlockFile $file = null) { if (!is_null($file)) { parent::__construct($file); if ($this->type == "x") { $paxArray = $this->getPaxDecodedHeader($file); $file->next(); } parent::__construct($file); // Override some fields. foreach ($paxArray as $key => $value) { switch ($key) { case "gid": $this->groupId = $value; break; // For group IDs larger than 2097151. // For group IDs larger than 2097151. case "linkpath": $this->linkName = $value; break; // Long link names? // Long link names? case "path": $this->fileName = $value; $this->filePrefix = ""; break; // Really long file names. // Really long file names. case "size": $this->size = $value; break; // For files with a size greater than 8589934591 bytes. // For files with a size greater than 8589934591 bytes. case "uid": $this->userId = $value; break; // For user IDs larger than 2097151. } } } }