mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
revert removal of permission properties
This commit is contained in:
@@ -647,6 +647,20 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
*/
|
*/
|
||||||
public $start_time = 0;
|
public $start_time = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* default file permissions
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $_file_perms = 0644;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* default dir permissions
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $_dir_perms = 0771;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* required by the compiler for BC
|
* required by the compiler for BC
|
||||||
*
|
*
|
||||||
|
@@ -29,16 +29,14 @@ class Smarty_Internal_Write_File
|
|||||||
{
|
{
|
||||||
$_error_reporting = error_reporting();
|
$_error_reporting = error_reporting();
|
||||||
error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING);
|
error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING);
|
||||||
$_file_perms = property_exists($smarty, '_file_perms') ? $smarty->_file_perms : 0644;
|
if ($smarty->_file_perms !== null) {
|
||||||
$_dir_perms = property_exists($smarty, '_dir_perms') ? (isset($smarty->_dir_perms) ? $smarty->_dir_perms : 0777) : 0644;
|
|
||||||
if ($_file_perms !== null) {
|
|
||||||
$old_umask = umask(0);
|
$old_umask = umask(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_dirpath = dirname($_filepath);
|
$_dirpath = dirname($_filepath);
|
||||||
// if subdirs, create dir structure
|
// if subdirs, create dir structure
|
||||||
if ($_dirpath !== '.' && !file_exists($_dirpath)) {
|
if ($_dirpath !== '.' && !file_exists($_dirpath)) {
|
||||||
mkdir($_dirpath, $_dir_perms, true);
|
mkdir($_dirpath, $smarty->_dir_perms === null ? 0777 : $smarty->_dir_perms, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// write to tmp file, then move to overt file lock race condition
|
// write to tmp file, then move to overt file lock race condition
|
||||||
@@ -78,9 +76,9 @@ class Smarty_Internal_Write_File
|
|||||||
error_reporting($_error_reporting);
|
error_reporting($_error_reporting);
|
||||||
throw new SmartyException("unable to write file {$_filepath}");
|
throw new SmartyException("unable to write file {$_filepath}");
|
||||||
}
|
}
|
||||||
if ($_file_perms !== null) {
|
if ($smarty->_file_perms !== null) {
|
||||||
// set file permissions
|
// set file permissions
|
||||||
chmod($_filepath, $_file_perms);
|
chmod($_filepath, $smarty->_file_perms);
|
||||||
umask($old_umask);
|
umask($old_umask);
|
||||||
}
|
}
|
||||||
error_reporting($_error_reporting);
|
error_reporting($_error_reporting);
|
||||||
|
Reference in New Issue
Block a user