Upgrade Smarty
This commit is contained in:
parent
efeacf5f22
commit
93918f5756
121 changed files with 8385 additions and 6267 deletions
|
|
@ -2,15 +2,15 @@
|
|||
/**
|
||||
* Smarty write file plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @package Smarty
|
||||
* @subpackage PluginsInternal
|
||||
* @author Monte Ohrt
|
||||
* @author Monte Ohrt
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty Internal Write File Class
|
||||
*
|
||||
* @package Smarty
|
||||
* @package Smarty
|
||||
* @subpackage PluginsInternal
|
||||
*/
|
||||
class Smarty_Internal_Write_File
|
||||
|
|
@ -18,9 +18,11 @@ class Smarty_Internal_Write_File
|
|||
/**
|
||||
* Writes file in a safe way to disk
|
||||
*
|
||||
* @param string $_filepath complete filepath
|
||||
* @param string $_contents file content
|
||||
* @param Smarty $smarty smarty instance
|
||||
* @param string $_filepath complete filepath
|
||||
* @param string $_contents file content
|
||||
* @param Smarty $smarty smarty instance
|
||||
*
|
||||
* @throws SmartyException
|
||||
* @return boolean true
|
||||
*/
|
||||
public static function writeFile($_filepath, $_contents, Smarty $smarty)
|
||||
|
|
@ -38,13 +40,11 @@ class Smarty_Internal_Write_File
|
|||
}
|
||||
|
||||
// write to tmp file, then move to overt file lock race condition
|
||||
$_tmp_file = $_dirpath . DS . uniqid('wrt', true);
|
||||
$_tmp_file = $_dirpath . DS . str_replace(array('.', ','), '_', uniqid('wrt', true));
|
||||
if (!file_put_contents($_tmp_file, $_contents)) {
|
||||
error_reporting($_error_reporting);
|
||||
throw new SmartyException("unable to write file {$_tmp_file}");
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Windows' rename() fails if the destination exists,
|
||||
|
|
@ -72,8 +72,6 @@ class Smarty_Internal_Write_File
|
|||
if (!$success) {
|
||||
error_reporting($_error_reporting);
|
||||
throw new SmartyException("unable to write file {$_filepath}");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($smarty->_file_perms !== null) {
|
||||
|
|
@ -85,5 +83,4 @@ class Smarty_Internal_Write_File
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue