Redbean + Smarty update

This commit is contained in:
Robin Kloppe 2014-10-13 11:24:53 +02:00
parent c1b8226466
commit eb0835ff74
122 changed files with 12653 additions and 11637 deletions

View file

@ -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;
}
}