From 1fdd2149ee90dfc6a48d08477c00bc583e29b6b0 Mon Sep 17 00:00:00 2001 From: messju Date: Sun, 23 Nov 2003 08:37:43 +0000 Subject: [PATCH] avoid touch()-ing of recently unlinked files by touch()-ing the tempfile before rename instead of touch()-ing the resulting file after rename. --- libs/core/core.write_compiled_resource.php | 3 +-- libs/core/core.write_file.php | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/core/core.write_compiled_resource.php b/libs/core/core.write_compiled_resource.php index 09b50d3b..c701448c 100644 --- a/libs/core/core.write_compiled_resource.php +++ b/libs/core/core.write_compiled_resource.php @@ -25,10 +25,9 @@ function smarty_core_write_compiled_resource($params, &$smarty) return false; } - $_params = array('filename' => $params['compile_path'], 'contents' => $params['compiled_content'], 'create_dirs' => true); + $_params = array('filename' => $params['compile_path'], 'timestamp'=>$params['resource_timestamp'], 'contents' => $params['compiled_content'], 'create_dirs' => true); require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_file.php'); smarty_core_write_file($_params, $smarty); - touch($params['compile_path'], $params['resource_timestamp']); return true; } diff --git a/libs/core/core.write_file.php b/libs/core/core.write_file.php index c92454d4..b4fa92e5 100644 --- a/libs/core/core.write_file.php +++ b/libs/core/core.write_file.php @@ -33,6 +33,9 @@ function smarty_core_write_file($params, &$smarty) } fwrite($fd, $params['contents']); + if (isset($params['timestamp'])) { + touch($_tmp_file, $params['timestamp']); + } fclose($fd); if(file_exists($params['filename'])) { @unlink($params['filename']);