cvs: pear /Archive_Tar/Archive Tar.php

From: Date: Thu, 01 Jul 2004 11:05:46 +0000
Subject: cvs: pear /Archive_Tar/Archive Tar.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-21345@lists.php.net to get a copy of this message
vblavet Thu Jul 1 07:05:46 2004 EDT Modified files: /pear/Archive_Tar/Archive Tar.php Log: - Add _isArchive() internal method - Correct the missing clearstatcache() statment http://cvs.php.net/diff.php/pear/Archive_Tar/Archive/Tar.php?r1=1.19&r2=1.20&ty=u Index: pear/Archive_Tar/Archive/Tar.php diff -u pear/Archive_Tar/Archive/Tar.php:1.19 pear/Archive_Tar/Archive/Tar.php:1.20 --- pear/Archive_Tar/Archive/Tar.php:1.19 Sat May 8 05:56:26 2004 +++ pear/Archive_Tar/Archive/Tar.php Thu Jul 1 07:05:46 2004 @@ -16,7 +16,7 @@ // | Author: Vincent Blavet <vincent@blavet.net> | // +----------------------------------------------------------------------+ // -// $Id: Tar.php,v 1.19 2004/05/08 09:56:26 vblavet Exp $ +// $Id: Tar.php,v 1.20 2004/07/01 11:05:46 vblavet Exp $ require_once 'PEAR.php'; @@ -27,7 +27,7 @@ * Creates a (compressed) Tar archive * * @author Vincent Blavet <vincent@blavet.net> -* @version $Revision: 1.19 $ +* @version $Revision: 1.20 $ * @package Archive */ class Archive_Tar extends PEAR @@ -328,7 +328,7 @@ { $v_result = true; - if (!@is_file($this->_tarname)) + if (!$this->_isArchive()) $v_result = $this->createModify($p_filelist, $p_add_dir, $p_remove_dir); else { if (is_array($p_filelist)) @@ -362,8 +362,8 @@ function addString($p_filename, $p_string) { $v_result = true; - - if (!@is_file($this->_tarname)) { + + if (!$this->_isArchive()) { if (!$this->_openWrite()) { return false; } @@ -561,6 +561,17 @@ } // }}} + // {{{ _isArchive() + function _isArchive($p_filename=NULL) + { + if ($p_filename == NULL) { + $p_filename = $this->_tarname; + } + clearstatcache(); + return @is_file($p_filename); + } + // }}} + // {{{ _openWrite() function _openWrite() { @@ -885,7 +896,7 @@ $v_stored_filename = $this->_pathReduction($v_stored_filename); - if (is_file($p_filename)) { + if ($this->_isArchive($p_filename)) { if (($v_file = @fopen($p_filename, "rb")) == 0) { $this->_warning("Unable to open file '$p_filename' in binary read mode"); return true; @@ -1383,7 +1394,7 @@ $this->_error('File '.$v_header['filename'].' already exists as a directory'); return false; } - if ((is_file($v_header['filename'])) && ($v_header['typeflag'] == "5")) { + if (($this->_isArchive($v_header['filename'])) && ($v_header['typeflag'] == "5")) { $this->_error('Directory '.$v_header['filename'].' already exists as a file'); return false; }

« previous php.pear.cvs (#21345) next »