Skip to content

Commit

Permalink
Fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jan 7, 2025
1 parent 1544aaf commit 6b94a45
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions htdocs/core/lib/functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -7946,8 +7946,6 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart = '
*/
function dol_mkdir($dir, $dataroot = '', $newmask = '')
{
global $conf;

dol_syslog("functions.lib::dol_mkdir: dir=".$dir, LOG_INFO);

$dir = dol_sanitizePathName($dir, '_', 0);
Expand Down Expand Up @@ -7985,17 +7983,17 @@ function dol_mkdir($dir, $dataroot = '', $newmask = '')
if ($ccdir) {
$ccdir_osencoded = dol_osencode($ccdir);
if (!@is_dir($ccdir_osencoded)) {
dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' does not exists or is outside open_basedir PHP setting.", LOG_DEBUG);
dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' is not found (does not exists or is outside open_basedir PHP setting).", LOG_DEBUG);

umask(0);
$dirmaskdec = octdec((string) $newmask);
if (empty($newmask)) {
$dirmaskdec = !getDolGlobalString('MAIN_UMASK') ? octdec('0755') : octdec($conf->global->MAIN_UMASK);
$dirmaskdec = getDolGlobalString('MAIN_UMASK', octdec('0755'));
}
$dirmaskdec |= octdec('0111'); // Set x bit required for directories
if (!@mkdir($ccdir_osencoded, $dirmaskdec)) {
// If the is_dir has returned a false information, we arrive here
dol_syslog("functions.lib::dol_mkdir: Fails to create directory '".$ccdir."' or directory already exists.", LOG_WARNING);
dol_syslog("functions.lib::dol_mkdir: Fails to create directory '".$ccdir."' (no permission to write into parent or directory already exists).", LOG_WARNING);
$nberr++;
} else {
dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' created", LOG_DEBUG);
Expand Down

0 comments on commit 6b94a45

Please sign in to comment.