mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
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:
@@ -25,10 +25,9 @@ function smarty_core_write_compiled_resource($params, &$smarty)
|
|||||||
return false;
|
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');
|
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_file.php');
|
||||||
smarty_core_write_file($_params, $smarty);
|
smarty_core_write_file($_params, $smarty);
|
||||||
touch($params['compile_path'], $params['resource_timestamp']);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,6 +33,9 @@ function smarty_core_write_file($params, &$smarty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fwrite($fd, $params['contents']);
|
fwrite($fd, $params['contents']);
|
||||||
|
if (isset($params['timestamp'])) {
|
||||||
|
touch($_tmp_file, $params['timestamp']);
|
||||||
|
}
|
||||||
fclose($fd);
|
fclose($fd);
|
||||||
if(file_exists($params['filename'])) {
|
if(file_exists($params['filename'])) {
|
||||||
@unlink($params['filename']);
|
@unlink($params['filename']);
|
||||||
|
Reference in New Issue
Block a user