forked from Wavyzz/dolibarr
Enhance error management of unzip
This commit is contained in:
@@ -2325,7 +2325,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
|
||||
*/
|
||||
function dol_uncompress($inputfile, $outputdir)
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
global $langs, $db;
|
||||
|
||||
$fileinfo = pathinfo($inputfile);
|
||||
$fileinfo["extension"] = strtolower($fileinfo["extension"]);
|
||||
@@ -2355,6 +2355,12 @@ function dol_uncompress($inputfile, $outputdir)
|
||||
$errmsg = $langs->trans("ErrorFailToCreateDir", $val['filename']);
|
||||
break;
|
||||
}
|
||||
if ($val['status'] == 'write_protected') {
|
||||
$langs->load("errors");
|
||||
$ok = 0;
|
||||
$errmsg = $langs->trans("ErrorFailToCreateFile", $val['filename']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ok) {
|
||||
|
||||
@@ -1667,6 +1667,7 @@ class Website extends CommonObject
|
||||
|
||||
// Export on target sources
|
||||
$resultarray = dol_uncompress($pathtotmpzip, $destdir);
|
||||
|
||||
if (!empty($resultarray)) {
|
||||
setEventMessages("Error, failed to unzip the export into target dir", null, 'errors');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user