Remove Box/Zip in favour of library (#1123)

Remove custom Box/Zip class in favour of nelexa/zip library.
This commit is contained in:
Adam Daley authored and GitHub committed 2023-04-22 07:21:34 +02:00
1 parent 511898ff8f
commit 69193e402f
4 files changed
+32 -156

No files matched your search

+11 -2
View File
@@ -13,6 +13,8 @@
* with this source code in the file LICENSE
*/
use PhpZip\ZipFile;
class Box_Update
{
/**
@@ -175,8 +177,15 @@ class Box_Update
//@todo validate downloaded file hash
// Extract latest archive on top of current version
$ff = new Box_Zip($latest_version_archive);
$ff->decompress(PATH_ROOT);
$zip = new ZipFile();
try {
$zip->openFile($latest_version_archive);
$zip->extractTo(PATH_ROOT);
$zip->close();
} catch (\PhpZip\Exception\ZipException $e) {
error_log($e->getMessage());
throw new \Box_Exception('Failed to extract file, please check file and folder permissions. Further details are available in the error log.');
}
if(file_exists(PATH_ROOT.'/foss-update.php')) {
error_log('Calling foss-update.php script from auto-updater');