cvs: pear /File_Archive Archive.php /File_Archive/Archive Reader.php /File_Archive/Archive/Writer Output.php
| From: | Vincent Lascaux | Date: | Wed, 25 May 2005 17:26:45 +0000 |
| Subject: | cvs: pear /File_Archive Archive.php /File_Archive/Archive Reader.php /File_Archive/Archive/Writer Output.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-32123@lists.php.net to get a copy of this message | ||
vincentlascaux Wed May 25 13:26:45 2005 EDT
Modified files:
/pear/File_Archive Archive.php
/pear/File_Archive/Archive Reader.php
/pear/File_Archive/Archive/Writer Output.php
Log:
+ Returns an error if the headers were already sent when using output writer
+ Changes the size of the default buffer to 8192 (8kiB)
http://cvs.php.net/diff.php/pear/File_Archive/Archive.php?r1=1.45&r2=1.46&ty=u
Index: pear/File_Archive/Archive.php
diff -u pear/File_Archive/Archive.php:1.45 pear/File_Archive/Archive.php:1.46
--- pear/File_Archive/Archive.php:1.45 Wed May 25 12:48:22 2005
+++ pear/File_Archive/Archive.php Wed May 25 13:26:43 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.45 2005/05/25 16:48:22 vincentlascaux Exp $
+ * @version CVS: $Id: Archive.php,v 1.46 2005/05/25 17:26:43 vincentlascaux Exp $
* @link http://pear.php.net/package/File_Archive
*/
@@ -895,14 +895,17 @@
*
* @param File_Archive_Reader $source The source that will be read
* @param File_Archive_Writer $dest Where to copy $source files
+ * @param bool $autoClose if true (default), $dest will be closed after the extraction
+ * @param int $bufferSize Size of the buffer to use to move data from the reader to the buffer
+ * You shouldn't need to change that
* @return null or a PEAR error if an error occured
*/
- function extract(&$source, &$dest)
+ function extract(&$source, &$dest, $autoClose = true, $bufferSize = 8192)
{
if (PEAR::isError($source)) {
return $source;
}
- return $source->extract($dest);
+ return $source->extract($dest, $autoClose, $bufferSize);
}
}
http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader.php?r1=1.20&r2=1.21&ty=u
Index: pear/File_Archive/Archive/Reader.php
diff -u pear/File_Archive/Archive/Reader.php:1.20 pear/File_Archive/Archive/Reader.php:1.21
--- pear/File_Archive/Archive/Reader.php:1.20 Mon May 23 08:46:57 2005
+++ pear/File_Archive/Archive/Reader.php Wed May 25 13:26:44 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: Reader.php,v 1.20 2005/05/23 12:46:57 vincentlascaux Exp $
+ * @version CVS: $Id: Reader.php,v 1.21 2005/05/25 17:26:44 vincentlascaux Exp $
* @link http://pear.php.net/package/File_Archive
*/
@@ -289,7 +289,7 @@
* Default value is 100kB
*/
function extractFile($filename, &$writer,
- $autoClose = true, $bufferSize = 102400)
+ $autoClose = true, $bufferSize = 8192)
{
if (PEAR::isError($writer)) {
return $writer;
http://cvs.php.net/diff.php/pear/File_Archive/Archive/Writer/Output.php?r1=1.6&r2=1.7&ty=u
Index: pear/File_Archive/Archive/Writer/Output.php
diff -u pear/File_Archive/Archive/Writer/Output.php:1.6
pear/File_Archive/Archive/Writer/Output.php:1.7
--- pear/File_Archive/Archive/Writer/Output.php:1.6 Thu Feb 24 08:30:57 2005
+++ pear/File_Archive/Archive/Writer/Output.php Wed May 25 13:26:44 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: Output.php,v 1.6 2005/02/24 13:30:57 vincentlascaux Exp $
+ * @version CVS: $Id: Output.php,v 1.7 2005/05/25 17:26:44 vincentlascaux Exp $
* @link http://pear.php.net/package/File_Archive
*/
@@ -61,9 +61,16 @@
function newFile($filename, $stat = array(), $mime = "application/octet-stream")
{
if ($this->sendHeaders) {
+ if(headers_sent()) {
+ return PEAR::raiseError(
+ 'The headers have already been sent. '.
+ 'Use File_Archive::toOutput(false) to write '.
+ 'to output without sending headers');
+ }
+
header("Content-type: $mime");
header("Content-disposition: attachment; filename=$filename");
- $this->sendHeaders = FALSE;
+ $this->sendHeaders = false;
}
}
/**