mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 19:34:27 +02:00
Better recognize Windows filesystems to reduce warnings
This commit is contained in:
3
NEWS
3
NEWS
@@ -1,4 +1,5 @@
|
||||
- emulate %R in the date_format modifier on windows (Danilo Buerger, boots)
|
||||
- update smarty_core_write_file() to better recognize Windows (boots)
|
||||
- emulate %R in the date_format modifier on Windows (Danilo Buerger, boots)
|
||||
|
||||
Version 2.6.16 (Dec 1st, 2006)
|
||||
-------------------------------
|
||||
|
@@ -15,6 +15,10 @@
|
||||
*/
|
||||
function smarty_core_write_file($params, &$smarty)
|
||||
{
|
||||
static $OS;
|
||||
if (is_null($OS)) {
|
||||
$OS = substr(PHP_OS,0,3);
|
||||
}
|
||||
$_dirname = dirname($params['filename']);
|
||||
|
||||
if ($params['create_dirs']) {
|
||||
@@ -37,7 +41,7 @@ function smarty_core_write_file($params, &$smarty)
|
||||
fwrite($fd, $params['contents']);
|
||||
fclose($fd);
|
||||
|
||||
if (PHP_OS == 'Windows' || !@rename($_tmp_file, $params['filename'])) {
|
||||
if ($OS == 'WIN' || !@rename($_tmp_file, $params['filename'])) {
|
||||
// On platforms and filesystems that cannot overwrite with rename()
|
||||
// delete the file before renaming it -- because windows always suffers
|
||||
// this, it is short-circuited to avoid the initial rename() attempt
|
||||
|
Reference in New Issue
Block a user