From 00c8b27baf46188a8bb054004898fd902729de1a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Oct 2015 22:04:54 +0200 Subject: [PATCH] Add code comment --- htdocs/core/lib/files.lib.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index aa804cf1255..d65f85bd59d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -949,8 +949,12 @@ function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1) } else dol_syslog("files.lib.php::dol_move failed", LOG_WARNING); } - if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; - @chmod($newpathofdestfile, octdec($newmask)); + if (empty($newmask)) $newmask=empty($conf->global->MAIN_UMASK)?'0755':$conf->global->MAIN_UMASK; + $newmaskdec=octdec($newmask); + // Currently method is restricted to files (dol_delete_files previously used is for files, and mask usage if for files too) + // to allow mask usage for dir, we shoul introduce a new param "isdir" to 1 to complete newmask like this + // if ($isdir) $newmaskdec |= octdec('0111'); // Set x bit required for directories + @chmod($newpathofdestfile, $newmaskdesc); } return $result;