{
$this->_data = null;
if (!extension_loaded('zlib'))
{
if (class_exists('JError'))
{
}
else
{
throw new RuntimeException('The zlib extension is not available.');
}
}
if (!isset($options['use_streams']) || $options['use_streams'] == false)
{
$this->_data = file_get_contents($archive);
if (!$this->_data)
{
if (class_exists('JError'))
{
}
else
{
throw new RuntimeException('Unable to read archive');
}
}
$buffer = gzinflate(substr($this->_data, $position, strlen($this->_data) - $position));
if (empty($buffer))
{
if (class_exists('JError'))
{
}
else
{
throw new RuntimeException('Unable to decompress data');
}
}
{
if (class_exists('JError'))
{
}
else
{
throw new RuntimeException('Unable to write archive');
}
}
}
else
{
$input->set('processingmethod', 'gz');
if (!$input->open($archive))
{
if (class_exists('JError'))
{
}
else
{
throw new RuntimeException('Unable to read archive (gz)');
}
}
if (!$output->open($destination, 'w'))
{
$input->close();
if (class_exists('JError'))
{
}
else
{
throw new RuntimeException('Unable to write archive (gz)');
}
}
do
{
$this->_data = $input->read($input->get('chunksize', 8196));
if ($this->_data)
{
if (!$output->write($this->_data))
{
$input->close();
if (class_exists('JError'))
{
}
else
{
throw new RuntimeException('Unable to write file (gz)');
}
}
}
}
while ($this->_data);
$output->close();
$input->close();
}
return true;
}