<?php
/////////////////////////////////////////////////
-// $Id: dump.inc.php,v 1.17 2004/09/26 12:29:36 henoheno Exp $
+// $Id: dump.inc.php,v 1.18 2004/09/26 12:49:50 henoheno Exp $
// Originated as tarfile.inc.php by teanan / Interfair Laboratory 2004.
// [¹¹¿·ÍúÎò]
}
/////////////////////////////////////////////////
-// tarlib: library for tar file creation and expansion
+// tarlib: a class library for tar file creation and expansion
// Tar related definition
define('TARLIB_HDR_LEN', 512); // ¥Ø¥Ã¥À¤ÎÂ礤µ
var $dummydata;
// ¥³¥ó¥¹¥È¥é¥¯¥¿
- function tarlib( $name = '' ) {
- $this->filename = $name;
+ function tarlib() {
+ $this->filename = '';
$this->fp = FALSE;
$this->status = TARLIB_STATUS_INIT;
$this->arc_kind = ARCFILE_TAR_GZ;
// °ú¿ô : tar¥Õ¥¡¥¤¥ë¤òºîÀ®¤¹¤ë¥Ñ¥¹
// ÊÖ¤êÃÍ: TRUE .. À®¸ù , FALSE .. ¼ºÇÔ
////////////////////////////////////////////////////////////
- function create($odir, $kind = ARCFILE_TAR_GZ)
+ function create($tempdir, $kind = ARCFILE_TAR_GZ)
{
- $tname = tempnam($odir, 'tar');
+ $tempnam = tempnam($tempdir, 'tarlib_');
+ if ($tempnam === FALSE) return FALSE;
if ($kind == ARCFILE_TAR_GZ) {
$this->arc_kind = ARCFILE_TAR_GZ;
- $this->fp = gzopen($tname, 'wb');
+ $this->fp = gzopen($tempnam, 'wb');
} else {
$this->arc_kind = ARCFILE_TAR;
- $this->fp = @fopen($tname, 'wb');
+ $this->fp = @fopen($tempnam, 'wb');
}
- if ($this->fp === FALSE) return FALSE; // ºîÀ®¼ºÇÔ
+ if ($this->fp === FALSE) return FALSE;
- // ºîÀ®¤ËÀ®¸ù¤·¤¿¤é¥Õ¥¡¥¤¥ë̾¤òµ²±¤·¤Æ¤ª¤¯
- $this->filename = $tname;
- $this->status = TARLIB_STATUS_CREATE;
-
- // ¥À¥ß¡¼¥Ç¡¼¥¿
+ $this->filename = $tempnam;
$this->dummydata = join('', array_fill(0, TARLIB_BLK_LEN, "\0"));
+ $this->status = TARLIB_STATUS_CREATE;
+
rewind($this->fp);
return TRUE;