Created
August 27, 2012 17:25
-
-
Save realityking/3490578 to your computer and use it in GitHub Desktop.
Fast ZIP extraction for Joomla
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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