avoid touch()-ing of recently unlinked files by touch()-ing the

tempfile before rename instead of touch()-ing the resulting file after
rename.
This commit is contained in:
messju
2003-11-23 08:37:43 +00:00
parent 2a6b5479dd
commit 1fdd2149ee
2 changed files with 4 additions and 2 deletions

View File

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

View File

@@ -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']);