mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 02:14:26 +02:00
fix 'mkdir(): File exists' error on create directory from parallel
processes
This commit is contained in:
@@ -37,9 +37,11 @@ class Smarty_Internal_Runtime_WriteFile
|
||||
}
|
||||
|
||||
$_dirpath = dirname($_filepath);
|
||||
|
||||
// if subdirs, create dir structure
|
||||
if ($_dirpath !== '.' && !file_exists($_dirpath)) {
|
||||
mkdir($_dirpath, $_dir_perms, true);
|
||||
if ($_dirpath !== '.' && !@mkdir($_dirpath, $_dir_perms, true) && !is_dir($_dirpath)) {
|
||||
error_reporting($_error_reporting);
|
||||
throw new SmartyException("unable to create directory {$_dirpath}");
|
||||
}
|
||||
|
||||
// write to tmp file, then move to overt file lock race condition
|
||||
|
Reference in New Issue
Block a user