Lines Matching full:file
6 * print each extracted file
19 protected $file = ''; variable in VerboseTar
27 * Open an existing TAR file for reading
29 * @param string $file
33 public function open($file, $comptype = self::COMPRESS_AUTO) { argument
35 if($comptype == self::COMPRESS_AUTO) $comptype = $this->filetype($file);
39 $this->file = $file;
42 $this->fh = @gzopen($this->file, 'rb');
44 $this->fh = @bzopen($this->file, 'r');
46 $this->fh = @fopen($this->file, 'rb');
49 … if(!$this->fh) throw new VerboseTarIOException('Could not open file for reading: '.$this->file);
57 * arrays containing for each file the following information:
59 * checksum Tar Checksum of the file
60 * filename The full name of the stored file (up to 100 c.)
72 * Reopen the file with open() again if you want to do additional operations
75 …if($this->closed || !$this->file) throw new VerboseTarIOException('Can not read from a closed arch…
94 …* found in the tar file, similar to the --strip-components feature of GNU tar. This is triggered w…
106 * Reopen the file with open() again if you want to do additional operations
116 …if($this->closed || !$this->file) throw new VerboseTarIOException('Can not read from a closed arch…
125 // read the file header
175 // is this a file?
178 … if(!$fp) throw new VerboseTarIOException('Could not open file for writing: '.$output);
202 * Create a new TAR file
204 * If $file is empty, the tar file will be created in memory
206 * @param string $file
212 public function create($file = '', $comptype = self::COMPRESS_AUTO, $complevel = 9) { argument
214 if($comptype == self::COMPRESS_AUTO) $comptype = $this->filetype($file);
218 $this->file = $file;
222 if($this->file) {
224 $this->fh = @gzopen($this->file, 'wb'.$complevel);
226 $this->fh = @bzopen($this->file, 'w');
228 $this->fh = @fopen($this->file, 'wb');
231 … if(!$this->fh) throw new VerboseTarIOException('Could not open file for writing: '.$this->file);
238 * Add a file to the current TAR archive using an existing file in the filesystem
241 * @param string $file the original file
242 * @param string $name the name to use for the file in the archive
245 public function addFile($file, $name = '') { argument
248 if(!$name) $name = $file;
251 $fp = fopen($file, 'rb');
252 if(!$fp) throw new VerboseTarIOException('Could not open file for reading: '.$file);
254 // create file header and copy all stat info from the original file
255 clearstatcache(false, $file);
256 $stat = stat($file);
261 fileperms($file),
262 filesize($file),
263 filemtime($file)
277 * Add a file to the current TAR archive using the given $data as content
308 * Add the closing footer to the archive if in write mode, close all file handles
313 …* "Physically, an archive consists of a series of file entries terminated by an end-of-archive ent…
327 // close file handles
328 if($this->file) {
337 $this->file = '';
364 * let the library work on the new file directly.
366 * @param $file
371 public function save($file, $comptype = self::COMPRESS_AUTO, $complevel = 9) { argument
372 if($comptype === self::COMPRESS_AUTO) $comptype = $this->filetype($file);
374 if(!file_put_contents($file, $this->getArchive($comptype, $complevel))) {
375 throw new VerboseTarIOException('Could not write to file: '.$file);
380 * Read from the open file pointer
403 if(!$this->file) {
418 * Skip forward in the open file pointer
436 * Write a file header
451 $file = basename($name);
453 if(strlen($file) > 100 || strlen($dir) > 155) {
463 $name = $file;
490 * Decode the given tar file header
579 * @param string $file
582 public function filetype($file) { argument
583 $file = strtolower($file);
584 if(substr($file, -3) == '.gz' || substr($file, -4) == '.tgz') {
586 } elseif(substr($file, -4) == '.bz2' || substr($file, -4) == '.tbz') {