cvs: pear /File_Archive Archive.php /File_Archive/Archive/Reader Uncompress.php /File_Archive/tests test.php

From: Date: Wed, 25 May 2005 16:48:23 +0000
Subject: cvs: pear /File_Archive Archive.php /File_Archive/Archive/Reader Uncompress.php /File_Archive/tests test.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-32122@lists.php.net to get a copy of this message
vincentlascaux Wed May 25 12:48:23 2005 EDT Modified files: /pear/File_Archive Archive.php /pear/File_Archive/Archive/Reader Uncompress.php /pear/File_Archive/tests test.php Log: + A bug in uncompress makeWriter function (it needs to keep the writer from used to reach the base dir) + Add an append function in File_Archive + Better error handling in File_Archive::readArchive http://cvs.php.net/diff.php/pear/File_Archive/Archive.php?r1=1.44&r2=1.45&ty=u Index: pear/File_Archive/Archive.php diff -u pear/File_Archive/Archive.php:1.44 pear/File_Archive/Archive.php:1.45 --- pear/File_Archive/Archive.php:1.44 Mon May 23 14:54:33 2005 +++ pear/File_Archive/Archive.php Wed May 25 12:48:22 2005 @@ -27,7 +27,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Archive.php,v 1.44 2005/05/23 18:54:33 vincentlascaux Exp $ + * @version CVS: $Id: Archive.php,v 1.45 2005/05/25 16:48:22 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -384,8 +384,12 @@ * $source interpreting it as a $extension archive * If $extension is not handled return false */ - function readArchive($extension, $source, $sourceOpened = false) + function readArchive($extension, &$source, $sourceOpened = false) { + if (PEAR::isError($source)) { + return $source; + } + switch($extension) { case 'tgz': return File_Archive::readArchive('tar', @@ -489,6 +493,34 @@ } /** + * Generate a writer to append data to the specified source + * The source will be closed and should no longer be used + * + * To add foo.bar to the existing archive.tar archive, do the following: + * <sample> + * //Append data to a tar archive + * //Do not forget the trailing / (which is here to ask to considere + * //archive.tar as an archive rather than a file) + * File_Archive::extract( + * File_Archive::read('foo.bar'), + * File_Archive::append(File_Archive::read('archive.tar/')), + * ); + * </sample> + * + * Files cannot be appended to nested archives + * + * @param File_Archive_Reader the source where files will be appended + * @return File_Archive_Writer a writer that writes at the end of the source + */ + function append(&$source) + { + if (PEAR::isError($source)) { + return $source; + } + return $source->makeAppendWriter(); + } + + /** * Removes from a source the files that do not follow a given predicat * * @param File_Archive_Predicate $predicate Only the files for which http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Uncompress.php?r1=1.26&r2=1.27&ty=u Index: pear/File_Archive/Archive/Reader/Uncompress.php diff -u pear/File_Archive/Archive/Reader/Uncompress.php:1.26 pear/File_Archive/Archive/Reader/Uncompress.php:1.27 --- pear/File_Archive/Archive/Reader/Uncompress.php:1.26 Mon May 23 14:54:36 2005 +++ pear/File_Archive/Archive/Reader/Uncompress.php Wed May 25 12:48:22 2005 @@ -25,7 +25,7 @@ * @author Vincent Lascaux <vincentlascaux@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.gnu.org/copyleft/lesser.html LGPL - * @version CVS: $Id: Uncompress.php,v 1.26 2005/05/23 18:54:36 vincentlascaux Exp $ + * @version CVS: $Id: Uncompress.php,v 1.27 2005/05/25 16:48:22 vincentlascaux Exp $ * @link http://pear.php.net/package/File_Archive */ @@ -146,7 +146,8 @@ //Remove the readers we have completly read from the stack do { while (($error = $this->source->next()) === false) { - if (empty($this->readers)) { + if (empty($this->readers) || + count($this->readers)+1 == $this->baseDirCompressionLevel) { return false; } $this->source->close(); http://cvs.php.net/diff.php/pear/File_Archive/tests/test.php?r1=1.34&r2=1.35&ty=u Index: pear/File_Archive/tests/test.php diff -u pear/File_Archive/tests/test.php:1.34 pear/File_Archive/tests/test.php:1.35 --- pear/File_Archive/tests/test.php:1.34 Mon May 23 15:25:24 2005 +++ pear/File_Archive/tests/test.php Wed May 25 12:48:22 2005 @@ -302,6 +302,7 @@ ); } + function testMultiWriter() { $this->assertTrue(

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