2
0
forked from Wavyzz/dolibarr

Enhance error management of unzip

This commit is contained in:
Laurent Destailleur
2024-01-31 23:03:48 +01:00
parent 0949c1402a
commit 5d795cee23
2 changed files with 8 additions and 1 deletions

View File

@@ -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) {

View File

@@ -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 {