<?php
// PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: file.php,v 1.20 2005/04/17 06:16:17 henoheno Exp $
+// $Id: file.php,v 1.21 2005/04/17 06:42:26 henoheno Exp $
//
// File related functions
// Try to chown by re-creating files
// NOTE:
- // * @unlink() before rename() is for Windows but here's for Unix only
+ // * touch() before copy() is for 'rw-r--r--' instead of 'rwxr-xr-x' (with umask 022).
// * (PHP 4 < PHP 4.2.0) touch() with the third argument is not implemented and retuns NULL and Warn.
+ // * @unlink() before rename() is for Windows but here's for Unix only
flock($ffile, LOCK_EX) or die('pkwk_chown(): flock() failed');
- $result = copy($filename, $tmp) &&
+ $result = touch($tmp) && copy($filename, $tmp) &&
($preserve_time ? (touch($tmp, $stat[9], $stat[8]) || touch($tmp, $stat[9])) : TRUE) &&
rename($tmp, $filename);
flock($ffile, LOCK_UN) or die('pkwk_chown(): flock() failed');