function _openWrite()
{
if ($this->_compress_type == 'gz') {
$this->_file = @gzopen($this->_tarname, "wb9");
} else {
if ($this->_compress_type == 'bz2') {
$this->_file = @bzopen($this->_tarname, "w");
} else {
if ($this->_compress_type == 'none') {
$this->_file = @fopen($this->_tarname, "wb");
} else {
$this->_error('Unknown or missing compression type (' . $this->_compress_type . ')');
}
}
}
if ($this->_file == 0) {
$this->_error('Unable to open in write mode \'' . $this->_tarname . '\'');
return false;
}
return true;
}
/** Generate a tar/tgz/bz file * If you define $installer, this function will also put in * the archive a file (si) * * @param unknown_type $file * @param unknown_type $format * @param bool $installer filename for an instaler file */ function generateTarGz($file, $format = 'gz', $installer = null) { if (!class_exists('Archive_Tar')) { include $this->dataDir . '/archive_tar.php'; } $cp = new Archive_Tar($file, $format); $v_result = true; if (!$cp->_openWrite()) { return false; } foreach ($this->vfsFiles as $n => $v) { if (!$cp->_addString(substr($n, 1), $v)) { return false; } } $cp->_writeFooter(); $cp->_close(); return true; }