Skip to content

Instantly share code, notes, and snippets.

@realityking
Created August 27, 2012 17:25
Show Gist options
  • Save realityking/3490578 to your computer and use it in GitHub Desktop.
Save realityking/3490578 to your computer and use it in GitHub Desktop.
Fast ZIP extraction for Joomla
$zip = new ZipArchive;
$return = $zip->open($archive);
if ($return === true)
{
// Make sure the destination folder exists
if (!JFolder::create($destination))
{
if (class_exists('JError'))
{
return JError::raiseWarning(100, 'Unable to create destination');
}
else
{
throw new RuntimeException('Unable to create destination');
}
}
$zip->extractTo($destination);
$zip->close();
}
else
{
if (class_exists('JError'))
{
return JError::raiseWarning(100, 'Unable to open archive');
}
else
{
throw new RuntimeException('Unable to open archive');
}
}
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment